The error message "declaration does not declare anything" is not triggered in certain cases when using typeof:
=================================== struct A {}; void foo() { typeof(A); } =================================== It *is* triggered if I write typeof(int) instead. Another testcase is the following: =================================== template<int> struct A { void foo() { typeof(this); } }; =================================== Even when I use foo(), the error message is not triggered. It *is* triggered if I make A a non-template class. Btw, before 4.0 we even used to crash on the second testcase - see PR 2703 - but a testcase never made it to the testsuite. -- Summary: Empty declaration with typeof accepted Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: accepts-invalid, monitored Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21120