Using decltype with virtual member function pointers

Can decltype be used with virtual member function pointers?

Then an internal error is generated (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 } 

This is mistake?

+6
source share
1 answer

MSVC has several known issues with decltype for member function pointers; see also Using decltype with member function pointers

This is legal syntax; g ++ is quite happy with this ( http://ideone.com/sTZi6 ). There is nothing in the standard that could limit the decltype function of member functions.

+4
source

Source: https://habr.com/ru/post/919777/


All Articles