public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96363] bogus error with multiple constrained partial specialization forward declarations Date: Thu, 26 May 2022 13:43:29 +0000 [thread overview] Message-ID: <bug-96363-4-Lwu1nqdQ7Q@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-96363-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96363 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:97dc78d705a90c1ae83c78a7f2e24942cc3a6257 commit r13-779-g97dc78d705a90c1ae83c78a7f2e24942cc3a6257 Author: Patrick Palka <ppalka@redhat.com> Date: Thu May 26 09:43:14 2022 -0400 c++: constrained partial spec forward decl [PR96363] Here during cp_parser_single_declaration for #2, we were calling associate_classtype_constraints for TPL<T> (the primary template type) before maybe_process_partial_specialization could get a chance to notice that we're in fact declaring a distinct constrained partial spec and not redeclaring the primary template. This caused us to emit a bogus error about differing constraints b/t the primary template and #2's constraints. This patch fixes this by moving the call to associate_classtype_constraints after the call to shadow_tag (which calls maybe_process_partial_specialization) and adjusting shadow_tag to use the return value of m_p_p_s. Moreover, if we later try to define a constrained partial specialization that's been declared earlier (as in the third testcase), then maybe_new_partial_specialization correctly notices it's a redeclaration and returns NULL_TREE. But in this case we also need to update TYPE to point to the redeclared partial spec (it'll otherwise continue pointing to the primary template type, eventually leading to a bogus error). PR c++/96363 gcc/cp/ChangeLog: * decl.cc (shadow_tag): Use the return value of maybe_process_partial_specialization. * parser.cc (cp_parser_single_declaration): Call shadow_tag before associate_classtype_constraints. * pt.cc (maybe_new_partial_specialization): Change return type to bool. Take 'type' argument by mutable reference. Set 'type' to point to the correct constrained specialization when appropriate. (maybe_process_partial_specialization): Adjust accordingly. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-partial-spec12.C: New test. * g++.dg/cpp2a/concepts-partial-spec12a.C: New test. * g++.dg/cpp2a/concepts-partial-spec13.C: New test.
next prev parent reply other threads:[~2022-05-26 13:43 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-28 21:50 [Bug c++/96363] New: bogus error with constrained partial specialization nathan at gcc dot gnu.org 2020-07-29 12:04 ` [Bug c++/96363] " ppalka at gcc dot gnu.org 2020-07-29 13:32 ` redi at gcc dot gnu.org 2022-05-24 16:52 ` ppalka at gcc dot gnu.org 2022-05-24 16:53 ` ppalka at gcc dot gnu.org 2022-05-25 16:20 ` [Bug c++/96363] bogus error with multiple constrained partial specialization forward declarations ppalka at gcc dot gnu.org 2022-05-26 13:43 ` cvs-commit at gcc dot gnu.org [this message] 2022-05-26 13:45 ` ppalka at gcc dot gnu.org 2022-07-21 16:47 ` cvs-commit at gcc dot gnu.org 2022-07-21 16:48 ` 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-96363-4-Lwu1nqdQ7Q@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).