https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118101
Bug ID: 118101 Summary: [modules] ICE: canonical types differ for identical types Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nshead at gcc dot gnu.org Blocks: 103524 Target Milestone: --- Consider the following: // test.hpp template <typename> struct A; template <typename T> struct A<T*> {}; template <typename T> struct B { static A<T*> x; }; using C = B<int>; // a.cpp module; #include "test.hpp" export module A; C c1; // b.cpp module; #include "test.hpp" export module B; import A; C c2; // c.cpp template <typename> struct A {}; template <typename T> struct B { static A<T*> x; }; template struct B<int>; import B; On trunk this gives the following error: $ g++-15 -fmodules-ts -S [abc].cpp c.cpp:3:17: internal compiler error: canonical types differ for identical types ‘A<T*>’ and ‘A<T*>’ 3 | template struct B<int>; | ^~~~~~ 0x3cd9843 internal_error(char const*, ...) ../../gcc/gcc/diagnostic-global-context.cc:517 0x1351145 comptypes(tree_node*, tree_node*, int) ../../gcc/gcc/cp/typeck.cc:1738 0x132c850 cp_tree_equal(tree_node*, tree_node*) ../../gcc/gcc/cp/tree.cc:4323 0x110cacb is_matching_decl ../../gcc/gcc/cp/module.cc:11688 0x10fc0b4 decl_value ../../gcc/gcc/cp/module.cc:8565 0x1101681 tree_node ../../gcc/gcc/cp/module.cc:9639 0x111e024 module_state::read_cluster(unsigned int) ../../gcc/gcc/cp/module.cc:15671 0x1128a56 module_state::load_section(unsigned int, binding_slot*) ../../gcc/gcc/cp/module.cc:19103 0x112b6ec module_state::lazy_load(unsigned int, binding_slot*) ../../gcc/gcc/cp/module.cc:19890 0x110420f tree_node ../../gcc/gcc/cp/module.cc:10202 0x111d3ef module_state::read_cluster(unsigned int) ../../gcc/gcc/cp/module.cc:15526 0x1128a56 module_state::load_section(unsigned int, binding_slot*) ../../gcc/gcc/cp/module.cc:19103 0x112b6ec module_state::lazy_load(unsigned int, binding_slot*) ../../gcc/gcc/cp/module.cc:19890 0x110420f tree_node ../../gcc/gcc/cp/module.cc:10202 0x111d3ef module_state::read_cluster(unsigned int) ../../gcc/gcc/cp/module.cc:15526 0x1128a56 module_state::load_section(unsigned int, binding_slot*) ../../gcc/gcc/cp/module.cc:19103 0x112b6ec module_state::lazy_load(unsigned int, binding_slot*) ../../gcc/gcc/cp/module.cc:19890 0x110420f tree_node ../../gcc/gcc/cp/module.cc:10202 0x111d3ef module_state::read_cluster(unsigned int) ../../gcc/gcc/cp/module.cc:15526 0x1128a56 module_state::load_section(unsigned int, binding_slot*) ../../gcc/gcc/cp/module.cc:19103 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Accidentally found while attempting to reduce the bug described in PR118049. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524 [Bug 103524] [meta-bug] modules issue