From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A4DB3858CDB; Fri, 3 Nov 2023 17:27:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A4DB3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699032473; bh=SIfhc9lNoZZZJsPI8YxyYBQnrxAnHvbMueBKZnAkpWc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yvkveHi+cwiF5hltu5iXL9g87Mj/pg/xHFMR7/+Nu/EqYZBrugxQid8LtRENjecU+ 3iTrspWjOt7o2YFvATYhomAE7fSTRt5Ccj5XCdALj9gHV2A+/JCY5Qikjo9ucxrdSY XawgDtslscC3z/DNblaG4xaPSOHX+Ga/Uki/59qw= From: "ppalka at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112288 --- Comment #8 from Patrick Palka --- The issue was probably latent before r6-6830. The testcase is kind of stra= nge, e.g. 'slot_allocated' is defined within 'allocate_slot' instead of within 'slot', which would arguably be more natural given that its 'slot' funct= ion 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 struct slot { template friend constexpr bool slot_allocated(slot, U); }; template struct allocate_slot { template friend constexpr bool slot_allocated(slot, U) { return true; } }; template{}, 0)> constexpr int next(int) { return 0; } template constexpr int next(...) { allocate_slot s; return 42; } // slot_allocated, int>() not defined yet static_assert(next(0) =3D=3D 42); // now it's defined static_assert(next(0) =3D=3D 0);=