template < void ( *F )() > struct X { }; template < typename T > struct Y { static void f() { } typedef X< f > F; }; Y< void > test; $ g++ 0.cpp -c 0.cpp: In instantiation of ‘Y<void>’: 0.cpp:9: instantiated from here 0.cpp:7: error: ‘static void Y<T>::f() [with T = void]’ cannot appear in a constant-expression
*** Bug 35570 has been marked as a duplicate of this bug. ***
4.1.3, msvc8 and comeau accept this code.
Doing: typedef X<Y:: f > F; Fixes the error message.
*** This bug has been marked as a duplicate of 35167 ***
(In reply to comment #3) > Doing: > typedef X<Y:: f > F; > > > Fixes the error message. > oh, so the comeau accepts invalid code :-)