https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125206
Bug ID: 125206
Summary: [reflection] Internal compiler error when using
bases_of
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pdimov at gmail dot com
Target Milestone: ---
The following program
```
#include <meta>
#include <type_traits>
template<auto...> struct mp_list_v
{
};
template<class...> struct mp_list
{
};
template<auto V> using mp_value = std::integral_constant<decltype(V), V>;
template<class L, template<class...> class B> struct mp_rename_impl;
template<template<class...> class L, class... T, template<class...> class B>
struct mp_rename_impl<L<T...>, B>
{
using type = B<T...>;
};
template<template<auto...> class L, auto... A, template<class...> class B>
struct mp_rename_impl<L<A...>, B>
{
using type = B<mp_value<A>...>;
};
template<class L, template<class...> class B> using mp_rename = typename
mp_rename_impl<L, B>::type;
class X1
{
};
class Z: public X1
{
};
int main()
{
constexpr auto all = std::meta::access_context::unchecked();
constexpr auto L1 = ^^mp_list_v< bases_of(^^Z, all)[0] >;
using L2 = mp_rename<typename [: L1 :], mp_list>;
}
```
yields
```
<source>: In substitution of 'template<class L, template<class ...> class B>
using mp_rename = typename mp_rename_impl::type [with L =
mp_list_v<^^'tree_binfo' not supported by dump_expr<expression error> >; B =
mp_list]':
<source>:40:52: required from here
40 | using L2 = mp_rename<typename [: L1 :], mp_list>;
| ^
<source>:26:53: internal compiler error: in strip_typedefs_expr, at
cp/tree.cc:2169
26 | template<class L, template<class...> class B> using mp_rename =
typename mp_rename_impl<L, B>::type;
| ^~~~~~~~~
0x29af4f8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x29a413b internal_error(char const*, ...)
???:0
0xb2a4d8 fancy_abort(char const*, int, char const*)
???:0
0xe5bac7 strip_typedefs_expr(tree_node*, bool*, unsigned int)
???:0
0xdcb855 most_specialized_partial_spec(tree_node*, int, bool)
???:0
0xde81e9 instantiate_class_template(tree_node*)
???:0
0xe60024 complete_type_or_maybe_complain(tree_node*, tree_node*, int)
???:0
0xdb7dc2 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0xdd28fd instantiate_template(tree_node*, tree_node*, int)
???:0
0xdb3f7e lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int)
???:0
0xe1cbac finish_template_type(tree_node*, tree_node*, int)
???:0
0xd7cb53 c_parse_file()
???:0
0xf0a999 c_common_parse_file()
???:0
/cefs/92/9269be2f3bb9bbf8ec2074f8_gcc-trunk-20260506/bin/../libexec/gcc/x86_64-linux-gnu/17.0.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/92/9269be2f3bb9bbf8ec2074f8_gcc-trunk-20260506/bin/../lib/gcc/x86_64-linux-gnu/17.0.0/
-D_GNU_SOURCE -isystem /opt/compiler-explorer/libs/boost_1_83_0 <source> -quiet
-dumpdir /app/ -dumpbase output.cpp -dumpbase-ext .cpp -masm=intel
-mtune=generic -march=x86-64 -g -O2 -std=c++26 -fdiagnostics-color=always
-fno-verbose-asm -freflection -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.
```
(https://godbolt.org/z/e1eM17cxc)