public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "language.lawyer at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/96593] New: No "declaration changes meaning" diagnostic for alias templates
Date: Wed, 12 Aug 2020 17:48:06 +0000	[thread overview]
Message-ID: <bug-96593-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 96593
           Summary: No "declaration changes meaning" diagnostic for alias
                    templates
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: language.lawyer at gmail dot com
  Target Milestone: ---

"A name N used in a class S shall refer to the same declaration in its context
and when re-evaluated in the completed scope of S. No diagnostic is required
for a violation of this rule."

The diagnostic for the rule is not required, but since GCC diagnoses some of
the cases, there is a bugreport about missing diagnostic cases (bug 46983), and
the check might become mandatory (will it?), I'd like file this bug.

GCC accepts the code with alias templates:

struct S {};

template <typename>
struct T {};

struct U
{
        template<typename>
        using S = S;

        template<typename>
        using T = T<void>;
};

but produces the "declaration changes meaning" error for type aliases.
GCC also diagnoses the case if the "outer" declaration is used before the
corresponding alias template:

struct S {};

struct U
{
        S s;

        template<typename>
        using S = S; // error: declaration of ... changes meaning of 'S'
};

(From https://stackoverflow.com/q/63369264/)

             reply	other threads:[~2020-08-12 17:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 17:48 language.lawyer at gmail dot com [this message]
2020-08-18 17:06 ` [Bug c++/96593] " mpolacek at gcc dot gnu.org
2021-09-22  9:13 ` gonzalo.gadeschi at gmail dot com
2021-09-22  9:14 ` gonzalo.gadeschi at gmail dot com

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-96593-4@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).