public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/107492] Unhelpful -Wignored-qualifiers warning in template specialization
Date: Tue, 15 Nov 2022 22:44:52 +0000	[thread overview]
Message-ID: <bug-107492-4-Papd2uniuL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107492-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2022-11-15 22:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 11:16 [Bug c++/107492] New: " 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
2022-11-03 20:11 ` redi at gcc dot gnu.org
2022-11-15 22:44 ` cvs-commit at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107492-4-Papd2uniuL@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).