Skip to content

Commit 536ae81

Browse files
committed
c++/modules: Fix ICE in instantiating_tu_local_entity [PR122628]
I'd missed a STRIP_TEMPLATE when attempting to query whether DECL was an imported entity. PR c++/122628 gcc/cp/ChangeLog: * module.cc (instantiating_tu_local_entity): Add missing STRIP_TEMPLATEs. gcc/testsuite/ChangeLog: * g++.dg/modules/internal-18.C: New test. Signed-off-by: Nathaniel Shead <[email protected]>
1 parent 2fbb6b2 commit 536ae81

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

gcc/cp/module.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14231,8 +14231,8 @@ instantiating_tu_local_entity (tree decl)
1423114231
return false;
1423214232

1423314233
tree origin = get_originating_module_decl (decl);
14234-
if (!DECL_LANG_SPECIFIC (origin)
14235-
|| !DECL_MODULE_IMPORT_P (origin))
14234+
if (!DECL_LANG_SPECIFIC (STRIP_TEMPLATE (origin))
14235+
|| !DECL_MODULE_IMPORT_P (STRIP_TEMPLATE (origin)))
1423614236
return false;
1423714237

1423814238
/* Referencing TU-local entities from a header is generally OK.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// PR c++/122628
2+
// { dg-additional-options "-fmodules" }
3+
4+
template <typename T> static void baz(T) {}
5+
template <typename T> static void bar(T) { baz(0); }
6+
7+
void foo() {
8+
bar(0);
9+
}

0 commit comments

Comments
 (0)