https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117400
Bug ID: 117400 Summary: ICE on invalid requires clause of generic lambda in function template Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eczbek.void at gmail dot com Target Milestone: --- https://godbolt.org/z/3MG6fMaa7 ``` template<int = 0> void f(){ [](auto) requires {} {}; // nonsense } int main() { f(); } ``` Using built-in specs. COLLECT_GCC=/opt/compiler-explorer/gcc-snapshot/bin/g++ Target: x86_64-linux-gnu Configured with: ../gcc-trunk-20241101/configure --prefix=/opt/compiler-explorer/gcc-build/staging --enable-libstdcxx-backtrace=yes --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 --enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix --with-pkgversion=Compiler-Explorer-Build-gcc-a287ff2697f0788856a21c99098611a5ae0a4749-binutils-2.42 Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20241031 (experimental) (Compiler-Explorer-Build-gcc-a287ff2697f0788856a21c99098611a5ae0a4749-binutils-2.42) COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-g' '-o' '/app/output.s' '-masm=intel' '-fno-verbose-asm' '-S' '-std=c++20' '-v' '-freport-bug' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' '/app/' /opt/compiler-explorer/gcc-trunk-20241101/bin/../libexec/gcc/x86_64-linux-gnu/15.0.0/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -iprefix /opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/ -D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext .cpp -masm=intel -mtune=generic -march=x86-64 -g -std=c++20 -version -fdiagnostics-color=always -fno-verbose-asm -freport-bug -o /app/output.s GNU C++20 (Compiler-Explorer-Build-gcc-a287ff2697f0788856a21c99098611a5ae0a4749-binutils-2.42) version 15.0.0 20241031 (experimental) (x86_64-linux-gnu) compiled by GNU C version 11.4.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring nonexistent directory "/opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../x86_64-linux-gnu/include" ignoring duplicate directory "/opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0" ignoring duplicate directory "/opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/x86_64-linux-gnu" ignoring duplicate directory "/opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/backward" ignoring duplicate directory "/opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/15.0.0/include" ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring duplicate directory "/opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/15.0.0/include-fixed/x86_64-linux-gnu" ignoring duplicate directory "/opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/15.0.0/include-fixed" ignoring nonexistent directory "/opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0 /opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/x86_64-linux-gnu /opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/backward /opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/include /opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/include-fixed/x86_64-linux-gnu /opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/x86_64-linux-gnu/15.0.0/include-fixed /usr/local/include /opt/compiler-explorer/gcc-trunk-20241101/bin/../lib/gcc/../../include /usr/include/x86_64-linux-gnu /usr/include End of search list. Compiler executable checksum: 5d8cc5497c4520f4a130bfbfe118f13a <source>: In function 'void f()': <source>:3:27: error: missing additional 'requires' to start a requires-expression [-Wtemplate-body] 3 | [](auto) requires {} {}; | ^ | requires <source>:3:28: error: expected primary-expression before '}' token [-Wtemplate-body] 3 | [](auto) requires {} {}; | ^ <source>:3:28: error: expected ';' before '}' token [-Wtemplate-body] 3 | [](auto) requires {} {}; | ^ | ; <source>: In instantiation of 'void f() [with int <anonymous> = 0]': <source>:7:3: required from here 7 | f(); | ~^~ <source>:3:12: error: '<anonymous>' has incomplete type 3 | [](auto) requires {} {}; | ^~~~ <source>:3:9: error: invalid use of template type parameter 'auto:1' 3 | [](auto) requires {} {}; | ^~~~~~~~~~~~~~~~~~~~~~~ <source>:3:9: internal compiler error: in type_dependent_expression_p, at cp/pt.cc:28727 0x287d6a5 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x28940c5 internal_error(char const*, ...) ???:0 0xa90afe fancy_abort(char const*, int, char const*) ???:0 0x176aa6c walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) ???:0 0x176e427 walk_tree_without_duplicates_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) ???:0 0xcb3b8a instantiation_dependent_expression_p(tree_node*) ???:0 0x176aa6c walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) ???:0 0x176ac82 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) ???:0 0x176b15d walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) ???:0 0xb2be03 cp_fold_function(tree_node*) ???:0 0xb7cc66 finish_function(bool) ???:0 0xbc2c82 maybe_add_lambda_conv_op(tree_node*) ???:0 0xcce98c tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0xcc618d instantiate_decl(tree_node*, bool, bool) ???:0 0xd00deb instantiate_pending_templates(int) ???:0 0xb95e5b c_parse_final_cleanups() ???:0 0xdf8318 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Preprocessed source stored into /tmp/cc22DNDB.out file, please attach this to your bugreport. Compiler returned: 1