https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118920
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nshead at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Last reconfirmed| |2025-02-19
Ever confirmed|0 |1
--- Comment #5 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Confirmed. Here's a fairly minimal reduction:
$ cat filesystem.hpp
template <typename T> struct __shared_ptr {
template <typename> friend struct out_ptr_t;
};
inline namespace __cxx11 __attribute__((__abi_tag__)) {
struct _Impl;
}
struct path {
__shared_ptr<_Impl> _M_impl;
};
$ cat memory.hpp
template <typename T> struct out_ptr_t {
operator int() const;
};
$ cat demo.hpp
#include "memory.hpp"
$ cat bug.cpp
export module Base;
import "memory.hpp";
import "filesystem.hpp";
import "demo.hpp";
$ g++ -fmodules -fno-module-lazy demo.hpp memory.hpp filesystem.hpp bug.cpp
bug.cpp:4:19: internal compiler error: canonical types differ for identical
types ‘const out_ptr_t<T>’ and ‘const out_ptr_t<T>’
4 | import "demo.hpp";
| ^
0x3cab7bf internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:517
0x136ec53 comptypes(tree_node*, tree_node*, int)
../../gcc/gcc/cp/typeck.cc:1738
0x136d75b structural_comptypes
../../gcc/gcc/cp/typeck.cc:1553
0x136ebd1 comptypes(tree_node*, tree_node*, int)
../../gcc/gcc/cp/typeck.cc:1731
0x1370258 compparms(tree_node const*, tree_node const*)
../../gcc/gcc/cp/typeck.cc:2049
0x111cbe1 check_mergeable_decl
../../gcc/gcc/cp/module.cc:11448
0x111e476 key_mergeable
../../gcc/gcc/cp/module.cc:11714
0x110d389 decl_value
../../gcc/gcc/cp/module.cc:8396
0x1114ad0 tree_node
../../gcc/gcc/cp/module.cc:9864
0x1133aa0 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:16290
0x113ed74 module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:19824
0x113ea70 module_state::read_language(bool)
../../gcc/gcc/cp/module.cc:19753
0x1142598 direct_import
../../gcc/gcc/cp/module.cc:20799
0x1142785 import_module(module_state*, unsigned long, bool, tree_node*,
cpp_reader*)
../../gcc/gcc/cp/module.cc:20839
0x11ad7e3 cp_parser_import_declaration
../../gcc/gcc/cp/parser.cc:15767
0x1192d91 cp_parser_translation_unit
../../gcc/gcc/cp/parser.cc:5434
0x121c201 c_parse_file()
../../gcc/gcc/cp/parser.cc:53949
0x14533b4 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.cc:1379
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.