Created attachment 52066 [details] preprocessed module source Exporting an alias to shared_ptr causes a compiler segfault on usage. This also breaks with unique_ptr, but works for other types. mod.cpp: module; #include <memory> export module tree; export template<typename T> using p = std::shared_ptr<T>; (mod.ii attached) main.cpp: import tree; int main() { p<long> t; } % gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.0 20211226 (experimental) (GCC) ``` Compiled using % g++ mod.cpp -c -fmodules-ts -std=c++20 -Wall -Wextra (no output) % g++ main.cpp -c -fmodules-ts -std=c++20 -Wall -Wextra In file included from /usr/local/include/c++/12.0.0/bits/shared_ptr.h:53, from /usr/local/include/c++/12.0.0/memory:77, from mod.cpp:2, of module tree, imported at main.cpp:1: /usr/local/include/c++/12.0.0/bits/shared_ptr_base.h: In instantiation of ‘class std::__shared_ptr@tree<long int, __gnu_cxx::_S_atomic>’: /usr/local/include/c++/12.0.0/bits/shared_ptr.h:124:11: required from ‘class std::shared_ptr@tree<long int>’ main.cpp:4:11: required from here Segmentation fault 1442 | struct __has_esft_base | ^~~~~~~~~~~~~~~ 0x1180abf crash_signal ../../gcc/toplev.c:322 0xa88d16 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*) ../../gcc/tree.h:3563 0xa88d16 get_originating_module_decl(tree_node*) ../../gcc/cp/module.cc:18339 0xa88e97 get_originating_module(tree_node*, bool) ../../gcc/cp/module.cc:18378 0xa301ef dump_module_suffix ../../gcc/cp/error.c:205 0xa301ef dump_module_suffix ../../gcc/cp/error.c:185 0xa30593 dump_aggr_type ../../gcc/cp/error.c:846 0xa3a352 decl_to_string ../../gcc/cp/error.c:3225 0xa3a352 cp_printer ../../gcc/cp/error.c:4396 0x20a99fa pp_format(pretty_printer*, text_info*) ../../gcc/pretty-print.c:1475 0x208be8b diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) ../../gcc/diagnostic.c:1346 0x208c3b8 diagnostic_impl ../../gcc/diagnostic.c:1508 0x208ccfa error_at(unsigned int, char const*, ...) ../../gcc/diagnostic.c:1831 0xa01d80 duplicate_decls(tree_node*, tree_node*, bool, bool) ../../gcc/cp/decl.c:1795 0xabb1ca check_module_override ../../gcc/cp/name-lookup.c:3586 0xabb1ca pushdecl(tree_node*, bool) ../../gcc/cp/name-lookup.c:3724 0xabd54c do_pushdecl_with_scope ../../gcc/cp/name-lookup.c:4767 0xabd77a pushdecl_namespace_level(tree_node*, bool) ../../gcc/cp/name-lookup.c:6088 0xb6e95f tsubst_friend_class ../../gcc/cp/pt.c:11444 0xb6e95f instantiate_class_template_1 ../../gcc/cp/pt.c:12171 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.
dup *** This bug has been marked as a duplicate of bug 105320 ***