struct A
{
enum InnerEnum { X };
A(InnerEnum x)
{}
};
int main()
{
A a(X);
}
The compiler complains: error C2065: 'X' : undeclared identifier
The compiler knows what the constructor's parameter type is, so when I pass X as the argument, the compiler should know it is a valid argument.
I know this is not ADL(Argument-dependent Name Lookup, also known as Koenig Lookup), but I think it's useful and pretty handy. Because I don't have to write as follows:
A a(A::X);
I think the ADL rule should be generalized to such a case.
Am I right?
X
? And regardless, the way I read your question, you're saying this is invalid C++, and are asking whether the C++ standard should change. This is the wrong place for that. – LevonaA::InnerEnum
value for a parameter. That enum definition is in theA
namespace scope and requires resolution when accessed outside of said-same. – Kanzu