Is it legal to use decltype with virtual member function pointers?
The following generates an internal error (C1001) with VS2012.
struct C
{
virtual void Foo() {}
typedef decltype(&C::Foo) type; //pointer
}
But this compiles fine:
struct C
{
virtual void Foo() {}
typedef decltype(C::Foo) type; //not pointer
}
Is it a bug?
MSVC has multiple known issues with
decltypeto member function pointers; see also Using decltype with member function pointersThis is legal syntax; g++ is perfectly happy with it (http://ideone.com/sTZi6). There is nothing in the standard to restrict the operation of
decltypeon member functions.