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

            Bug ID: 124824
           Summary: [reflection] Internal compiler error with template
                    argument of pointer to static local reflection: in
                    discriminator_for_local_entity, at cp/mangle.cc:2328
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: friedkeenan at protonmail dot com
  Target Milestone: ---

The erroring code:
```
template<auto>
void function() {}

void caller() {
    static constexpr auto Reflection = ^^int;

    function<&Reflection>();
}
```

Godbolt link: https://godbolt.org/z/hPqo46PW5

The crash output:
```
<source>:2:6: internal compiler error: in discriminator_for_local_entity, at
cp/mangle.cc:2328
    2 | void function() {}
      |      ^~~~~~~~
0x296bbf8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x296083b internal_error(char const*, ...)
        ???:0
0xb23e44 fancy_abort(char const*, int, char const*)
        ???:0
0xc8a6f9 mangle_decl(tree_node*)
        ???:0
0x18d7325 decl_assembler_name(tree_node*)
        ???:0
0xfd8096 symbol_table::finalize_compilation_unit()
        ???:0
```

My guess would be that it's the same issue as in Bug 98930, but that's been
fixed so I would suppose that the compiler is hitting some edge case with
reflection.

Reply via email to