[Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 1 15:40:43 GMT 2022


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2022-11-01

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I suspect we want to disable the warning while parsing a template argument,
like this:

--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -24334,6 +24334,7 @@ cp_parser_template_type_arg (cp_parser *parser)
   const char *saved_message = parser->type_definition_forbidden_message;
   parser->type_definition_forbidden_message
     = G_("types may not be defined in template arguments");
+  warning_sentinel w (warn_ignored_qualifiers);
   r = cp_parser_type_id_1 (parser, CP_PARSER_FLAGS_NONE, true, false, NULL);
   parser->type_definition_forbidden_message = saved_message;
   if (cxx_dialect >= cxx14 && !flag_concepts && type_uses_auto (r))


More information about the Gcc-bugs mailing list