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

            Bug ID: 125326
           Summary: [16/17 Regression] ICE in alias_ctad_tweaks for alias
                    template CTAD after invalid constructor parameter pack
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-checking, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: attackerj1113 at gmail dot com
  Target Milestone: ---

The following invalid C++ testcase causes GCC trunk to ICE in alias_ctad_tweaks
after diagnosing an unexpanded parameter pack. 

This appears to reproduce since GCC 16.1 with checking enabled.

Reduced testcase:
=========================================
template<class... T>
struct A {
  A(T);
};

template<class T>
using B = A<int>;

B b;
=========================================
Please check: https://godbolt.org/z/zcc1oznj3

Output:
=========================================
<source>:3:6: error: parameter packs not expanded with '...': [-Wtemplate-body]
    3 |   A(T);
      |      ^
<source>:3:6: note:         'T'
<source>:9:3: internal compiler error: tree check: expected tree that contains
'decl minimal' structure, have 'error_mark' in alias_ctad_tweaks, at
cp/pt.cc:32036
    9 | B b;
      |   ^
0x29d6af8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x29cb73b internal_error(char const*, ...)
        ???:0
0xa32574 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ???:0
0xda8fd2 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int, tree_node*)
        ???:0
0xc3f5c1 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int,
cp_decomp*)
        ???:0
0xd82993 c_parse_file()
        ???:0
0xf113f9 c_common_parse_file()
        ???:0
/cefs/ee/eed41a3e34266cd09176ffa5_gcc-trunk-20260515/bin/../libexec/gcc/x86_64-linux-gnu/17.0.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/ee/eed41a3e34266cd09176ffa5_gcc-trunk-20260515/bin/../lib/gcc/x86_64-linux-gnu/17.0.0/
-D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext
.cpp -masm=intel -mtune=generic -march=x86-64 -g -fdiagnostics-color=always
-fno-verbose-asm -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.
Compiler returned: 1
=========================================

Reply via email to