public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3414] c++ modules: handle CONCEPT_DECL in node_template_info [PR102963] Date: Thu, 20 Oct 2022 15:34:03 +0000 (GMT) [thread overview] Message-ID: <20221020153403.E148E3850413@sourceware.org> (raw) https://gcc.gnu.org/g:9a8b37f5476ba1f92fd9a85add035ace89535e79 commit r13-3414-g9a8b37f5476ba1f92fd9a85add035ace89535e79 Author: Patrick Palka <ppalka@redhat.com> Date: Thu Oct 20 11:33:39 2022 -0400 c++ modules: handle CONCEPT_DECL in node_template_info [PR102963] Here node_template_info is overlooking that CONCEPT_DECL has TEMPLATE_INFO too, which causes get_originating_module_decl for the CONCEPT_DECL to not return the corresponding TEMPLATE_DECL, which leads to an ICE from import_entity_index while pretty printing the CONCEPT_DECL's module suffix as part of the static assert failure elaboration. PR c++/102963 gcc/cp/ChangeLog: * module.cc (node_template_info): Handle CONCEPT_DECL. gcc/testsuite/ChangeLog: * g++.dg/modules/concept-7_a.C: New test. * g++.dg/modules/concept-7_b.C: New test. Diff: --- gcc/cp/module.cc | 1 + gcc/testsuite/g++.dg/modules/concept-7_a.C | 7 +++++++ gcc/testsuite/g++.dg/modules/concept-7_b.C | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 2c2f9a9a8cb..73971e7ff47 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -4046,6 +4046,7 @@ node_template_info (tree decl, int &use) || TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == FIELD_DECL + || TREE_CODE (decl) == CONCEPT_DECL || TREE_CODE (decl) == TEMPLATE_DECL)) { use_tpl = DECL_USE_TEMPLATE (decl); diff --git a/gcc/testsuite/g++.dg/modules/concept-7_a.C b/gcc/testsuite/g++.dg/modules/concept-7_a.C new file mode 100644 index 00000000000..a39b31bf7f0 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-7_a.C @@ -0,0 +1,7 @@ +// PR c++/102963 +// { dg-additional-options "-fmodules-ts -fconcepts" } +// { dg-module-cmi pr102963 } + +export module pr102963; + +export template<class T> concept C = __is_same(T, int); diff --git a/gcc/testsuite/g++.dg/modules/concept-7_b.C b/gcc/testsuite/g++.dg/modules/concept-7_b.C new file mode 100644 index 00000000000..1f81208ebd5 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-7_b.C @@ -0,0 +1,7 @@ +// PR c++/102963 +// { dg-additional-options "-fmodules-ts -fconcepts" } + +import pr102963; + +static_assert(C<int>); +static_assert(C<void>); // { dg-error "static assert" }
reply other threads:[~2022-10-20 15:34 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221020153403.E148E3850413@sourceware.org \ --to=ppalka@gcc.gnu.org \ --cc=gcc-cvs@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).