https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128564
Bug ID: 128564
Summary: ICE on very ill-formed code with lambda template
parameter lists
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marralesfios at gmail dot com
Target Milestone: ---
The following code causes GCC to crash:
template<typename T>
consteval void templ(T){}
consteval void a(){
templ([]<(return templ(templ<int,))
(No flags are needed to produce the crash.)
On my system's release build, it just says "confused by earlier errors, bailing
out" so the following stacktrace comes from Compiler Explorer
(https://godbolt.org/z/WTjv1a1YT):
<source>:2:16: internal compiler error: tree check: expected tree that contains
'decl common' structure, have 'error_mark' in decl_template_parm_check, at
cp/cp-tree.h:5614
2 | consteval void templ(T){}
| ^~~~~
0x2cc5c58 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2cba89b internal_error(char const*, ...)
???:0
0xa4f917 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
???:0
0xd1d379 mangle_decl(tree_node*)
???:0
0x19b3af5 decl_assembler_name(tree_node*)
???:0
0x1077ba6 symbol_table::finalize_compilation_unit()
???:0
Output of gcc -v (on Compiler Explorer):
Using built-in specs.
COLLECT_GCC=/opt/compiler-explorer/gcc-snapshot/bin/g++
Target: x86_64-linux-gnu
Configured with: ../gcc-trunk-20261108/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu
--enable-languages=c,c++,fortran,ada,objc,obj-c++,go,d,rust,m2,cobol,algol68
--enable-ld=yes --enable-gold=yes --enable-libstdcxx-time=yes
--enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build-gcc-bcf14085d8270f173ee6f1f4f9ae8352959e5ca1-binutils-2.47
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20261108 (experimental)
(Compiler-Explorer-Build-gcc-bcf14085d8270f173ee6f1f4f9ae8352959e5ca1-binutils-2.47)