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 decltype to member function pointers; see also Using decltype with member function pointers
This is legal syntax; g++ is perfectly happy with it (http://ideone.com/sTZi6).  There is nothing in the standard to restrict the operation of decltype on member functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With