* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
@ 2022-11-01 15:40 ` mpolacek at gcc dot gnu.org
2022-11-01 16:52 ` mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-11-01 15:40 UTC (permalink / raw)
To: gcc-bugs
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))
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
2022-11-01 15:40 ` [Bug c++/107492] " mpolacek at gcc dot gnu.org
@ 2022-11-01 16:52 ` mpolacek at gcc dot gnu.org
2022-11-02 12:56 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-11-01 16:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107492
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
2022-11-01 15:40 ` [Bug c++/107492] " mpolacek at gcc dot gnu.org
2022-11-01 16:52 ` mpolacek at gcc dot gnu.org
@ 2022-11-02 12:56 ` cvs-commit at gcc dot gnu.org
2022-11-03 19:05 ` jason at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-02 12:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107492
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:cf35818a390e7cb4b1a4fa70c243ede59d6cbbac
commit r13-3607-gcf35818a390e7cb4b1a4fa70c243ede59d6cbbac
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Nov 1 11:17:35 2022 +0000
libstdc++: Ignore -Wignored-qualifiers warning in <variant>
The warning is wrong here, the qualifier serves a purpose and is not
ignored (c.f. PR c++/107492).
libstdc++-v3/ChangeLog:
* include/std/variant (__variant::_Multi_array::__untag_result):
Use pragma to suppress warning.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
` (2 preceding siblings ...)
2022-11-02 12:56 ` cvs-commit at gcc dot gnu.org
@ 2022-11-03 19:05 ` jason at gcc dot gnu.org
2022-11-03 20:11 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-11-03 19:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107492
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #2)
> The warning is wrong here, the qualifier serves a purpose and is not
> ignored (c.f. PR c++/107492).
OK, I'm curious: what is its purpose?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
` (3 preceding siblings ...)
2022-11-03 19:05 ` jason at gcc dot gnu.org
@ 2022-11-03 20:11 ` redi at gcc dot gnu.org
2022-11-15 22:44 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-03 20:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107492
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I ... don't remember. It was needed to avoid some error, maybe from
std::visit<const void>(vis, var) of something like that. But either we never
added a test for it or something changed. I can't reproduce an error without
that partial specialization now.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
` (4 preceding siblings ...)
2022-11-03 20:11 ` redi at gcc dot gnu.org
@ 2022-11-15 22:44 ` cvs-commit at gcc dot gnu.org
2022-11-15 22:45 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-15 22:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107492
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:ed1797ddf8285f59a50d9c883beb97705279d980
commit r13-4077-ged1797ddf8285f59a50d9c883beb97705279d980
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Nov 1 11:49:03 2022 -0400
c++: Disable -Wignored-qualifiers for template args [PR107492]
It seems wrong to issue a -Wignored-qualifiers warning for code like:
static_assert(!is_same_v<void(*)(), const void(*)()>);
because there the qualifier matters. Likewise in template
specialization:
template<typename T> struct S { };
template<> struct S<void(*)()> { };
template<> struct S<const void(*)()> { }; // OK, not a redefinition
And likewise in other type-id contexts such as trailing-return-type:
auto g() -> const void (*)();
This patch limits the warning to the function declaration context only.
PR c++/107492
gcc/cp/ChangeLog:
* decl.cc (grokdeclarator): Only emit a -Wignored-qualifiers
warning
when funcdecl_p.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wignored-qualifiers3.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
` (5 preceding siblings ...)
2022-11-15 22:44 ` cvs-commit at gcc dot gnu.org
@ 2022-11-15 22:45 ` mpolacek at gcc dot gnu.org
2022-11-15 22:47 ` redi at gcc dot gnu.org
2022-11-28 22:21 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-11-15 22:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107492
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Resolved. Do we want to revert r13-3607?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
` (6 preceding siblings ...)
2022-11-15 22:45 ` mpolacek at gcc dot gnu.org
@ 2022-11-15 22:47 ` redi at gcc dot gnu.org
2022-11-28 22:21 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-15 22:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107492
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think clang warns there too, but we could.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
2022-11-01 11:16 [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization redi at gcc dot gnu.org
` (7 preceding siblings ...)
2022-11-15 22:47 ` redi at gcc dot gnu.org
@ 2022-11-28 22:21 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107492
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
^ permalink raw reply [flat|nested] 10+ messages in thread