Why is the below code invalid (at least using Visual Studio 2010 or ideone)?
// E.h
enum E
{
AN_E_VALUE
};
// C.h
class C
{
public:
explicit C(E e) // explicit keyword is optional
{}
void Foo() {}
};
// main.cpp
int main(int argc, char** argv)
{
C c(AN_E_VALUE); // fine
C(AN_E_VALUE); // error
C(AN_E_VALUE).Foo(); // fine
return 0;
}
If the parameter is anything but a single enumerated type, it works fine.
The compiler understands the erroneous call as one with 0 arguments where 1 is expected. Why is this?