From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A66AD386FC19; Wed, 23 Jun 2021 15:03:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A66AD386FC19 From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101174] [12 Regression] CTAD causes instantiation of invalid class specialization since r12-926 Date: Wed, 23 Jun 2021 15:03:11 +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: 12.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status assigned_to everconfirmed 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2021 15:03:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101174 Patrick Palka changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-06-23 Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot g= nu.org Ever confirmed|0 |1 --- Comment #2 from Patrick Palka --- The particular problem here is that during dguide overload resolution for multiset(42), we briefly consider the implicit deduction guide for the seco= nd ctor: template multiset(U) -> multiset which after substituting deduced template arguments becomes multiset(int) -> multiset and after r12-926, its (substituted) DECL_CONTEXT is also multiset rather than empty. Since DECL_CLASS_SCOPE_P is now true for implicit deduction guides, we try = to complete/instantiate its DECL_CONTEXT via the call to DERIVED_FROM_P in joust(): /* F1 is a member of a class D, F2 is a member of a base class B of D, and for all arguments the corresponding parameters of F1 and F2 have the s= ame type (CWG 2273/2277). */ if (DECL_P (cand1->fn) && DECL_CLASS_SCOPE_P (cand1->fn) && !DECL_CONV_FN_P (cand1->fn) && DECL_P (cand2->fn) && DECL_CLASS_SCOPE_P (cand2->fn) && !DECL_CONV_FN_P (cand2->fn)) { tree base1 =3D DECL_CONTEXT (strip_inheriting_ctors (cand1->fn)); tree base2 =3D DECL_CONTEXT (strip_inheriting_ctors (cand2->fn)); bool used1 =3D false; bool used2 =3D false; if (base1 =3D=3D base2) /* No difference. */; else if (DERIVED_FROM_P (base1, base2)) // XXX used1 =3D true; else if (DERIVED_FROM_P (base2, base1)) used2 =3D true; which results in the hard error seen. I'm testing setting DECL_BEFRIENDING_CLASSES instead of DECL_CONTEXT on an implicit deduction guide, to avoid such accidental instantiations=