http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51786
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-16 10:49:22 UTC --- The problem is that by the time at the end of cp_parser_simple_declaration we call check_tag_decl (via shadow_tag), which is supposed to check that the simple declaration is valid, we already called finish_decltype_type thus it doesn't see the decltype, it sees something like: void foo() { struct A; } a valid simple declaration.