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

            Bug ID: 128418
           Summary: ICE (segmentation fault) in mangle_decl with C++26
                    pack index as a function return type
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chickenporkgyoza at gmail dot com
  Target Milestone: ---

Compiling the following valid C++26 causes an internal compiler error
(segmentation fault) during the name-mangling phase (mangle_decl).

Command: g++ -std=c++26 -Wall -Wextra -c main.cpp

template<typename... Ts>
Ts...[0]::type f() {
        return {};
}

struct S {
        using type = int; 
};

int main() {
        f<S>();
}


Backtrace:
main.cpp:2:16: internal compiler error: Segmentation fault
    2 | Ts...[0]::type f() {
      |                ^
0x2ca8858 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*), diagnostics::kind)
        ???:0
0x2c9d49b internal_error(char const*, ...)
        ???:0
0xd16139 mangle_decl(tree_node*)
        ???:0
0x19a5305 decl_assembler_name(tree_node*)
        ???:0
0x106f5b6 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gnu.org> for instructions.

Reply via email to