public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78
Date: Fri, 03 Nov 2023 17:27:52 +0000	[thread overview]
Message-ID: <bug-112288-4-c6yB3ozqNE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112288-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The issue was probably latent before r6-6830.  The testcase is kind of strange,
e.g. 'slot_allocated' is defined within 'allocate_slot' instead of within
'slot', which would arguably be more natural given that its 'slot<T>' function
parameter.  And consecutive equivalent calls to 'next' apparently resolve to
different overloads due to 'slot_allocated' being defined only after we
instantiate the second 'next' overload.

Reduced:

template<class T>
struct slot {
  template<class U>
  friend constexpr bool slot_allocated(slot<T>, U);
};

template<class T>
struct allocate_slot {
  template<class U>
  friend constexpr bool slot_allocated(slot<T>, U) { return true; }
};

template<class T, bool = slot_allocated(slot<T>{}, 0)>
constexpr int next(int) { return 0; }

template<class T>
constexpr int next(...) { allocate_slot<T> s; return 42; }

// slot_allocated<slot<int>, int>() not defined yet
static_assert(next<int>(0) == 42);
// now it's defined
static_assert(next<int>(0) == 0);

  parent reply	other threads:[~2023-11-03 17:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 12:07 [Bug c++/112288] New: internal compiler error: in instantiate_decl, at cp/pt.cc:26861 falemagn at gmail dot com
2023-10-30 12:09 ` [Bug c++/112288] " falemagn at gmail dot com
2023-10-30 14:22 ` [Bug c++/112288] [14 Regression] ICE - " rguenth at gcc dot gnu.org
2023-10-30 16:28 ` [Bug c++/112288] [11/12/13/14 " mpolacek at gcc dot gnu.org
2023-10-30 16:31 ` mpolacek at gcc dot gnu.org
2023-10-30 17:43 ` falemagn at gmail dot com
2023-10-30 17:57 ` pinskia at gcc dot gnu.org
2023-10-30 18:03 ` mpolacek at gcc dot gnu.org
2023-10-30 20:55 ` falemagn at gmail dot com
2023-11-03 17:27 ` ppalka at gcc dot gnu.org [this message]
2023-11-03 17:36 ` [Bug c++/112288] [11/12/13/14 Regression] ICE - internal compiler error: in instantiate_decl, at cp/pt.cc:26861 since r6-6830-g20a0c6f9bdbd78 falemagn at gmail dot com
2023-11-04 18:41 ` ppalka at gcc dot gnu.org
2024-05-07  7:42 ` [Bug c++/112288] [11/12/13/14/15 " rguenth 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-112288-4-c6yB3ozqNE@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).