typedef int I; struct X { template<class> struct Y { } // oops, missing ';' static I f(); }; expinit.cc:7:12: error: expected initializer before ‘f’ If f returns 'int' instead of a typedef then the error is good: expinit.cc:5:30: error: expected ‘;’ after struct definition If X::Y is not a template then the error is good: expinit.cc:7:10: error: expected ‘;’ at end of member declaration expinit.cc:7:14: error: ISO C++ forbids declaration of ‘f’ with no type [-fpermissive]
I believe I tried to do that at one point; you can see the comment in cp/parser.c:class_specifier_1 about handling user-defined types. I might not have been clever enough, though. It'd certainly be helpful.
Confirmed.
Since GCC 6.1 the error is slightly better, although it suggests putting the semi-colon in the wrong place: tm.cc:7:3: error: a storage class can only be specified for objects and functions static I f(); ^~~~~~ tm.cc:7:9: error: expected ';' before 'I' static I f(); ^~ ;
GCC 9.1 has been released.
GCC 9.2 has been released.
ASSIGNED due to assignee
GCC 9.3.0 has been released, adjusting target milestone.
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
Clearing target milestone, I don't think Dave is going to fix this on the branches.