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 <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:ed1797ddf8285f59a50d9c883beb97705279d980

commit r13-4077-ged1797ddf8285f59a50d9c883beb97705279d980
Author: Marek Polacek <pola...@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.

Reply via email to