public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "herring at lanl dot gov" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/97340] New: Spurious rejection of member variable template of reference type
Date: Thu, 08 Oct 2020 16:36:22 +0000	[thread overview]
Message-ID: <bug-97340-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 97340
           Summary: Spurious rejection of member variable template of
                    reference type
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: herring at lanl dot gov
  Target Milestone: ---

In many recent versions of GCC, the following valid code

  struct A {
    template<class>
    static constexpr const int &x=0;
  };
  template<class T=void>
  struct B {
    static constexpr int y=A::template x<int>;
  };
  template struct B<>;

produces

error: ''indirect_ref' not supported by dump_decl<declaration error>' is not a
template [-fpermissive]
    7 |   static constexpr int y=A::template x<int>;
      |                          ~~~~~~~~~~~~^~~~~~

The 'template' after '::' here is unnecessary; removing it avoids the error,
but the error also appears if A is a class template (so that it's necessary to
write "A<T>::template x<int>").  Making A::x not be a reference also avoids the
error, as does referring to it from a non-templated context.

             reply	other threads:[~2020-10-08 16:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 16:36 herring at lanl dot gov [this message]
2020-10-08 17:15 ` [Bug c++/97340] " mpolacek at gcc dot gnu.org
2020-10-09  8:08 ` marxin at gcc dot gnu.org
2023-05-17 14:45 ` ppalka at gcc dot gnu.org
2023-05-19 13:40 ` cvs-commit at gcc dot gnu.org
2023-05-19 13:41 ` ppalka 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-97340-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).