https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127568
Bug ID: 127568
Summary: [regression 16] [modules] ICE on anonymous structs
named with typedef
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: samuelgardner101 at gmail dot com
Target Milestone: ---
The following code
```
export module m;
export template <typename T>
struct S {
typedef struct { char c[2]; } no;
};
```
causes an ICE
```
<source>:1:8: internal compiler error: in add_indirects, at cp/module.cc:8053
1 | export module m;
| ^~~~~~
0x2c54718 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2c4935b internal_error(char const*, ...)
???:0
0xb7d4e4 fancy_abort(char const*, int, char const*)
???:0
0xd2e9eb depset::hash::find_dependencies(module_state*)
???:0
0xd2f111 module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
???:0
0xd30c54 finish_module_processing(cpp_reader*)
???:0
0xca6730 c_parse_final_cleanups()
???:0
0xf699a8 c_common_parse_file()
???:0
/cefs/52/525fbcf787ef5372452d46c0_gcc-trunk-20260922/bin/../libexec/gcc/x86_64-linux-gnu/17.0.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/52/525fbcf787ef5372452d46c0_gcc-trunk-20260922/bin/../lib/gcc/x86_64-linux-gnu/17.0.0/
-D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext
.cpp -mtune=generic -march=x86-64 -g -std=c++26 -fdiagnostics-color=always
-fno-verbose-asm -fmodules -o /app/output.s
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.
Compiler returned: 1
```
tested on local gcc from trunk, and godbolt gcc trunk. regression from gcc 16
as 118829 says it's gone there, and tested on godbolt gcc 16, no issues.
strangely, it compiles in trunk if -freflection is enabled.