https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123913
Bug ID: 123913
Summary: [reflection] Internal Compiler Error in
eval_is_function_parameter at cp/reflect.cc:1656
materializing function type parameters
Product: gcc
Version: 16.0
URL: https://godbolt.org/z/zjbMWbren
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dwang0340 at gmail dot com
Target Milestone: ---
Hi,
There is an Internal Compiler Error when using
std::meta::reflect_constant_array on a range of parameters derived from a
function type.
Using gcc from trunk (20260201 on Compiler Explorer) with -std=c++26
-freflection.
Here is the snippet.
```
#include <meta>
void f(int, int) {}
using F_Type = void(int, int);
int main() {
// SUCCESS: Reflecting the declaration
constexpr auto a =
std::meta::reflect_constant_array(std::meta::parameters_of(^^f));
// ICE: Reflecting the type
// internal compiler error: in eval_is_function_parameter, at
cp/reflect.cc:1656
constexpr auto b =
std::meta::reflect_constant_array(std::meta::parameters_of(^^F_Type));
}
```
with error and backtrace
<source>: In function 'int main()':
<source>:12:57: internal compiler error: in eval_is_function_parameter, at
cp/reflect.cc:1656
12 | constexpr auto b =
std::meta::reflect_constant_array(std::meta::parameters_of(^^F_Type));
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x2959018 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x294dd5b internal_error(char const*, ...)
???:0
0xb202d8 fancy_abort(char const*, int, char const*)
???:0
0xc85f67 mangle_template_parm_object(tree_node*)
???:0
0xdee483 process_metafunction(constexpr_ctx const*, tree_node*, tree_node*,
bool*, bool*, tree_node**)
???:0
0xb8db7c cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
???:0
0xba56a9 maybe_constant_value(tree_node*, tree_node*, mce_value)
???:0
0xe71d37 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
???:0
0xc2b9a6 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int,
cp_decomp*)
???:0
0xd69d43 c_parse_file()
???:0
0xef3169 c_common_parse_file()
???:0
/cefs/b6/b6a171e3e22b9ae35ef1d360_gcc-trunk-20260201/bin/../libexec/gcc/x86_64-linux-gnu/16.0.1/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/b6/b6a171e3e22b9ae35ef1d360_gcc-trunk-20260201/bin/../lib/gcc/x86_64-linux-gnu/16.0.1/
-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 -freflection -o /app/output.s
Reproducible on Compiler Explorer at: https://godbolt.org/z/zjbMWbren