http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46206
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> --- More correctly: it seems that when we parse "typedef struct Bar { } Bar;" we create two TYPE_DECL: first, one marked as DECL_IMPLICIT_TYPEDEF_P in pushtag_1 (via create_implicit_typedef); then a second, real, one in grokdeclarator, via build_lang_decl (TYPE_DECL... ). When we do lookup for "struct Bar bar", it can happen, depending on layout details, that the *second* one is found, thus the check in check_elaborated_type_specifier triggers.