diff options
author | Marek Polacek <polacek@redhat.com> | 2022-11-01 11:49:03 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-11-15 17:44:13 -0500 |
commit | ed1797ddf8285f59a50d9c883beb97705279d980 (patch) | |
tree | 45f3b83dded8a3da2c41821a18ce8cdd6604dd05 /gcc/function.cc | |
parent | c717a92dd89321eeb74aaa3daeb32354ac588d20 (diff) | |
download | gcc-ed1797ddf8285f59a50d9c883beb97705279d980.zip gcc-ed1797ddf8285f59a50d9c883beb97705279d980.tar.gz gcc-ed1797ddf8285f59a50d9c883beb97705279d980.tar.bz2 |
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.
Diffstat (limited to 'gcc/function.cc')
0 files changed, 0 insertions, 0 deletions