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++/101174] [12 Regression] CTAD causes instantiation of invalid class specialization since r12-926 Date: Wed, 23 Jun 2021 15:03:11 +0000 [thread overview] Message-ID: <bug-101174-4-ZCQNv0fdy3@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101174-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101174 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-06-23 Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- The particular problem here is that during dguide overload resolution for multiset(42), we briefly consider the implicit deduction guide for the second ctor: template<class T = int, class U = S> multiset(U) -> multiset<T, U> which after substituting deduced template arguments becomes multiset(int) -> multiset<int, int> and after r12-926, its (substituted) DECL_CONTEXT is also multiset<int, int> 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 same 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 = DECL_CONTEXT (strip_inheriting_ctors (cand1->fn)); tree base2 = DECL_CONTEXT (strip_inheriting_ctors (cand2->fn)); bool used1 = false; bool used2 = false; if (base1 == base2) /* No difference. */; else if (DERIVED_FROM_P (base1, base2)) // XXX used1 = true; else if (DERIVED_FROM_P (base2, base1)) used2 = 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
next prev parent reply other threads:[~2021-06-23 15:03 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-23 3:41 [Bug c++/101174] New: [12 Regression] CTAD causes instantiation of invalid specialization ppalka at gcc dot gnu.org 2021-06-23 4:21 ` [Bug c++/101174] [12 Regression] CTAD causes instantiation of invalid specialization since r12-926 ppalka at gcc dot gnu.org 2021-06-23 15:03 ` ppalka at gcc dot gnu.org [this message] 2021-06-23 21:27 ` [Bug c++/101174] [12 Regression] CTAD causes instantiation of invalid class " cvs-commit at gcc dot gnu.org 2021-06-23 21:28 ` 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-101174-4-ZCQNv0fdy3@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: linkBe 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).