https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64127

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktietz at gcc dot gnu.org

--- Comment #2 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Nor does it with c++14.

Issue is that for -std=c++98 the tree isn't a template_decl.  Instead it is a
template_id_expr.

See parser.c:cp_parser_diagnose_invalid_type_name

...
else if (cxx_dialect < cxx11
         && !strcmp (IDENTIFIER_POINTER (id), "thread_local"))
...

By adding to this check '&& DECL_P (id)' fixes the ICE.

Index: parser.c
===================================================================
--- parser.c    (Revision 218142)
+++ parser.c    (Arbeitskopie)
@@ -2977,6 +2977,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *p
        inform (location, "C++11 %<noexcept%> only available with "
                "-std=c++11 or -std=gnu++11");
       else if (cxx_dialect < cxx11
+              && DECL_P (id)
               && !strcmp (IDENTIFIER_POINTER (id), "thread_local"))
        inform (location, "C++11 %<thread_local%> only available with "
                "-std=c++11 or -std=gnu++11");

Reply via email to