public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/104094] New: Alias template shown in diagnostic with wrong template parameter name
Date: Tue, 18 Jan 2022 13:22:55 +0000	[thread overview]
Message-ID: <bug-104094-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 104094
           Summary: Alias template shown in diagnostic with wrong template
                    parameter name
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

template<typename> struct trait;
template<typename A> struct trait { using type = A; };
template<typename B> struct cond { static constexpr bool value = true; };

template<bool> struct enable_if { using type = bool; };
template<> struct enable_if<false> { };

template<typename C>
class pair
{
  template<typename D>
    using constraint = cond<trait<D>>;

  template<typename E, typename enable_if<constraint<E>::value>::type = true>
    pair(E&&) { }
};

pair<int> p(1);


GCC prints:

name.C:18:14: error: 'pair<C>::pair(E&&) [with E = int; typename
enable_if<cond<trait<D> >::value>::type <anonymous> = true; C = int]' is
private within this context
   18 | pair<int> p(1);
      |              ^
name.C:15:5: note: declared private here
   15 |     pair(E&&) { }
      |     ^~~~


Why does it show cond<trait<D>> in the error? There is no D in that
constructor's parameter list, and D is not explained in the [with ...] template
arg list.

I think it should be shown as constraint<E> or as cond<trait<E>>, but showing D
is just confusing.

             reply	other threads:[~2022-01-18 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 13:22 redi at gcc dot gnu.org [this message]
2022-01-19  0:50 ` [Bug c++/104094] " pinskia at gcc dot gnu.org
2024-01-17 11:19 ` redi at gcc dot gnu.org
2024-01-20 18:46 ` pinskia at gcc dot gnu.org
2024-01-20 20:39 ` redi 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-104094-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).