https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125680

--- Comment #1 from Boning Chen <berningchen at gmail dot com> ---
This is another, simpler example:

#include <meta>
struct TestStruct
{
    struct
    {
        int b;
    } a[4];
};

template <std::meta::info type> struct GetSub
{
    consteval static std::meta::info get()
    {
        if constexpr (std::meta::is_array_type(type))
        {
            using MemberType = std::remove_extent_t<typename[:type:]>;
            return ^^MemberType;
        }
        else
        {
            constexpr auto subType =
std::meta::type_of(std::meta::nonstatic_data_members_of(type,
std::meta::access_context::current())[0]);
            using MemberType = typename[:subType:];
            return ^^MemberType;
        }
    }
    constexpr static std::meta::info value = get();
};

int main()
{
    constexpr auto a = GetSub<^^TestStruct>::value;
    constexpr auto b = GetSub<a>::value;
    constexpr auto c = GetSub<b>::value;

    return 0;
}

Output:

<source>:12:38: internal compiler error: in nested_anon_class_index, at
cp/mangle.cc:1814
   12 |     consteval static std::meta::info get()
      |                                      ^~~
0x29f7b88 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x29ec7cb internal_error(char const*, ...)
        ???:0
0xb34382 fancy_abort(char const*, int, char const*)
        ???:0
0xca1069 mangle_decl(tree_node*)
        ???:0
0x18fc585 decl_assembler_name(tree_node*)
        ???:0
0xff1546 symbol_table::finalize_compilation_unit()
        ???:0

Reply via email to