https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129115
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I have a patch for 1) and 2) but this:
$ cat testsuite/g++.dg/modules/reflect-4_a.H
// PR c++/129115
// { dg-do compile { target c++26 } }
// { dg-additional-options "-fmodule-header -freflection" }
// { dg-module-cmi {} }
template<typename T> using same = [: ^^T :];
$ cat testsuite/g++.dg/modules/reflect-4_b.C
// PR c++/129115
// { dg-do compile { target c++26 } }
// { dg-additional-options "-fmodules -freflection" }
// { dg-module-cmi a }
module;
#include "reflect-4_a.H"
export module a;
export same<int> fa ();
$ cat testsuite/g++.dg/modules/reflect-4_c.C
// PR c++/129115
// { dg-do compile { target c++26 } }
// { dg-additional-options "-fmodules -freflection" }
// { dg-module-cmi b }
module;
#include "reflect-4_a.H"
export module b;
export same<int> fb ();
$ cat testsuite/g++.dg/modules/reflect-4_d.C
// PR c++/129115
// { dg-do compile { target c++26 } }
// { dg-additional-options "-fmodules -freflection" }
import a;
import b;
int x = fa () + fb ();
shows another crash:
testsuite/g++.dg/modules/reflect-4_c.C:8:8: internal compiler error: in
write_location, at cp/module.cc:18843
0x325bc06 internal_error(char const*, ...)
/home/mpolacek/src/gcc/gcc/diagnostic-global-context.cc:787
0x326a691 fancy_abort(char const*, int, char const*)
/home/mpolacek/src/gcc/gcc/diagnostics/context.cc:1813
0x6b39b9 write_location
/home/mpolacek/src/gcc/gcc/cp/module.cc:18843
0x67883b core_vals
/home/mpolacek/src/gcc/gcc/cp/module.cc:6427
0x67eb8e tree_node_vals
/home/mpolacek/src/gcc/gcc/cp/module.cc:7893
0x6812fb decl_value
/home/mpolacek/src/gcc/gcc/cp/module.cc:8539
0x6852e5 decl_node
/home/mpolacek/src/gcc/gcc/cp/module.cc:9258
0x68b0fc tree_node
/home/mpolacek/src/gcc/gcc/cp/module.cc:10393
0x6aef9e module_state::write_cluster(elf_out*, depset**, unsigned int,
depset::hash&, unsigned int*, unsigned int*)
/home/mpolacek/src/gcc/gcc/cp/module.cc:17546
0x6baf27 module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
/home/mpolacek/src/gcc/gcc/cp/module.cc:21255
0x6c3f17 finish_module_processing(cpp_reader*)
/home/mpolacek/src/gcc/gcc/cp/module.cc:24018
0x5ca1ee c_parse_final_cleanups()
/home/mpolacek/src/gcc/gcc/cp/decl2.cc:6126
0xa303e3 c_common_parse_file()
/home/mpolacek/src/gcc/gcc/c-family/c-opts.cc:1477
I'd rather fix that separately.