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

            Bug ID: 128333
           Summary: [reflection] ICE using ^^ on a local reference
                    variable as a template argument
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bruck.michael at gmail dot com
  Target Milestone: ---

#include <meta>

template <std::meta::info v>
void foo()
{}

struct S
{
    int q = 42;

    void bar()
    {
        //int * r = &q; // no crash
        int & r = q;
        foo<^^r>();
    }
};

int main()
{
    S{}.bar();
    return 0;
}

On 17.0/trunk

<source>:23:1: internal compiler error: Segmentation fault
   23 | }
      | ^
0x2ca7ec8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2c9cb0b internal_error(char const*, ...)
        ???:0
0x104d9e8 symbol_table::decl_assembler_name_hash(tree_node const*)
        ???:0
0x1051cf4 symtab_node::get_for_asmname(tree_node const*)
        ???:0
0x1051e13 symtab_node::verify_base()
        ???:0
0x106484d cgraph_node::verify_node()
        ???:0
0x10529b4 symtab_node::verify()
        ???:0
0x1053b97 symtab_node::verify_symtab_nodes()
        ???:0
0x106f536 symbol_table::finalize_compilation_unit()
        ???:0
/cefs/4e/4e85bd7e707a2c87694f2ff1_gcc-trunk-20261031/bin/../libexec/gcc/x86_64-linux-gnu/17.0.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/4e/4e85bd7e707a2c87694f2ff1_gcc-trunk-20261031/bin/../lib/gcc/x86_64-linux-gnu/17.0.0/
-D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext
.cpp -mtune=generic -march=x86-64 -g -std=gnu++26 -fdiagnostics-color=always
-fno-verbose-asm -freflection -o /tmp/ccQLdu3v.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.
Compiler returned: 1

on 16.2:
during RTL pass: expand
<source>: In member function 'void S::bar()':
<source>:15:17: internal compiler error: Segmentation fault
   15 |         foo<^^r>();
      |         ~~~~~~~~^~
0x22a6498 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x229f78b internal_error(char const*, ...)
        ???:0
0x14088eb make_decl_rtl(tree_node*)
        ???:0
0xb5ba8c expand_call(tree_node*, rtx_def*, int)
        ???:0
0xc86ece expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
/cefs/17/17a2c76db590a13a8a92c74c_consolidated/compilers_c++_x86_gcc_16.2.0/bin/../libexec/gcc/x86_64-linux-gnu/16.2.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/17/17a2c76db590a13a8a92c74c_consolidated/compilers_c++_x86_gcc_16.2.0/bin/../lib/gcc/x86_64-linux-gnu/16.2.0/
-D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext
.cpp -mtune=generic -march=x86-64 -g -std=gnu++26 -fdiagnostics-color=always
-fno-verbose-asm -freflection -o /tmp/cc4qeHpm.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.
Compiler returned: 1

Reply via email to