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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |easyhack
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-08-04
                 CC|                            |manu at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
The code here:

     if (alias_template_specialization_p (type))
        error ("using alias template specialization %qT after %qs",
               type, tag_name (tag_code));
      else
        error ("using typedef-name %qD after %qs", decl, tag_name (tag_code));
      inform (DECL_SOURCE_LOCATION (decl),
              "%qD has a previous declaration here", decl);

needs to check for DECL_IS_BUILTIN(decl) or something similar. Also, for
consistency, it would be better to say: "%q#D previously declared here".

Perhaps:

     inform (DECL_SOURCE_LOCATION (decl),
             DECL_IS_BUILTIN(decl) ? _G("%q#D is a built-in type")
                                   : _G("%q#D previously declared here"),
            decl);

In theory, the diagnostics machinery should print

<built-in>: note: message

if DECL_SOURCE_LOCATION (decl) == BUILTINS_LOCATION. I wonder if the location
is wrong (perhaps UNKNOWN_LOCATION?) or the C++ FE (unintentionally?) overrides
the default location prefix for built-in.

Reply via email to