https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120775
--- Comment #22 from Desmond Gold <cooky.ykooc922 at gmail dot com> ---
another one:
template <typename>
void foo() {
constexpr int i = [:reflect_constant(5):];
constexpr info f = reflect_constant_array(
std::vector{1, 2, 3}
);
constexpr auto& arr = [:f:];
constexpr auto& arr2 = [:reflect_constant_array(
std::vector{1, 2, 3}
):];
}
void bar() {
constexpr auto& arr = [:reflect_constant_array(
std::vector{1, 2, 3}
):];
}
results in ICE when splicing 'reflect_constant_array(...)' inside template
definition (initializing 'arr2' inside 'foo'):
<source>: In function 'void foo()':
<source>:11:52: internal compiler error: in get_range_elts, at
cp/reflect.cc:355
11 | constexpr auto& arr2 = [:reflect_constant_array(
| ~~~~~~~~~~~~~~~~~~~~~~^
12 | std::vector{1, 2, 3}
| ~~~~~~~~~~~~~~~~~~~~
13 | ):];
| ~
0x29213e8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x29161db internal_error(char const*, ...)
???:0
0xb13bf4 fancy_abort(char const*, int, char const*)
???:0
0xdd40ec process_metafunction(constexpr_ctx const*, tree_node*, tree_node*,
bool*, bool*, tree_node**)
???:0
0xb80a41 cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
???:0
0xb92743 cxx_constant_value(tree_node*, tree_node*, int)
???:0
0xdc5c7c splice(tree_node*)
???:0
0xd502d3 c_parse_file()
???:0
0xed74c9 c_common_parse_file()
???:0
https://godbolt.org/z/qP8988P5b