https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125729
Bug ID: 125729
Summary: [C++26 Reflection] ICE in
symtab_node::verify_symtab_nodes due to unresolved
alias tokens breaking COMDAT group optimization
structures.
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: berningchen at gmail dot com
Target Milestone: ---
1. Minimal Reproducible Example
template <decltype(^^void) type>
struct Error
{
Error() {}
};
constexpr auto a = []() { using Type = int; return ^^Type; }();
constexpr auto b = []() { using Type = int; return ^^Type; }();
Error<a> c{};
Error<b> d{};
Tested against gcc-trunk-20260610 (with experimental -freflection enabled):
$ g++ -std=c++26 -freflection -g example.cpp
<source>:20:13: error: Two symbols with same comdat_group are not linked by the
same_comdat_group list.
20 | Error<b> d{};
| ^
_ZN5ErrorILDmta4Type_iEEC1Ev/14 (Error<type>::Error() [with std::meta::info
type = ^^Type])
Type: function definition analyzed alias cpp_implicit_alias
Visibility: semantic_interposition public weak comdat
comdat_group:_ZN5ErrorILDmta4Type_iEEC5Ev one_only
Same comdat group as: _ZN5ErrorILDmta4Type_iEEC2Ev/13
previous sharing asm name: 11
References: _ZN5ErrorILDmta4Type_iEEC2Ev/13 (alias)
Referring:
Function flags:
Called by: _Z41__static_initialization_and_destruction_0v/15
Calls:
_ZN5ErrorILDmta4Type_iEEC1Ev/11 (Error<type>::Error() [with std::meta::info
type = ^^Type])
Type: function definition analyzed alias cpp_implicit_alias
Visibility: semantic_interposition public weak comdat
comdat_group:_ZN5ErrorILDmta4Type_iEEC5Ev one_only
Same comdat group as: _ZN5ErrorILDmta4Type_iEEC2Ev/10
next sharing asm name: 14
References: _ZN5ErrorILDmta4Type_iEEC2Ev/10 (alias)
Referring:
Function flags:
Called by: _Z41__static_initialization_and_destruction_0v/15
Calls:
<source>:20:13: internal compiler error: symtab_node::verify failed
0x29f7a48 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x29ec68b internal_error(char const*, ...)
???:0
0xfd69ad symtab_node::verify_symtab_nodes()
???:0
0xff1466 symbol_table::finalize_compilation_unit()
???:0
/cefs/cb/cb63c344a811b21f8c6bef07_gcc-trunk-20260610/bin/../libexec/gcc/x86_64-linux-gnu/17.0.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/cb/cb63c344a811b21f8c6bef07_gcc-trunk-20260610/bin/../lib/gcc/x86_64-linux-gnu/17.0.0/
-D_GNU_SOURCE <source> -quiet -dumpdir /app/output.s- -dumpbase example.cpp
-dumpbase-ext .cpp -mtune=generic -march=x86-64 -g -std=c++26
-fdiagnostics-color=always -fno-verbose-asm -freflection -o /tmp/cctdbD1X.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.