[Bug c++/105667] [C++20] lambas in template argument sometimes causes an ICE (seg fault)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667 Alfred Agrell changed: What|Removed |Added CC||blubban at gmail dot com --- Comment #8 from Alfred Agrell --- I ran into something similar. My reduced testcase is struct class1 { virtual void a_function() = 0; }; template() {}> class class2 {}; template struct class3 : public class1 { void a_function() { class2<> x; } }; struct class4 : public class3 { class4() {} }; https://godbolt.org/z/GKo5oWe8j
[Bug c++/105667] [C++20] lambas in template argument sometimes causes an ICE (seg fault)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667 Eric Niebler changed: What|Removed |Added CC||eric.niebler at gmail dot com --- Comment #7 from Eric Niebler --- Another, even shorter repro: template (B){}> struct C { using D = void; }; template using E = C<>::D; using F = E<>;
[Bug c++/105667] [C++20] lambas in template argument sometimes causes an ICE (seg fault)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667 Barnabás Pőcze changed: What|Removed |Added CC||pobrn at protonmail dot com --- Comment #6 from Barnabás Pőcze --- Another snippet that I believe triggers the same issue: template struct get { }; template struct thing { using T = decltype([](auto) { }); static constexpr auto value = [](auto) { return get(); }(0); }; thing<0> X; --- In this case template_parms_to_args() is called with a nullptr. template_parms_to_args (parms=0x0) at /usr/src/debug/gcc/gcc/cp/pt.cc:4912 tsubst_template_decl (t=0x77177280, args=, complain=3, lambda_fntype=0x7717b738) at /usr/src/debug/gcc/gcc/cp/pt.cc:14543 tsubst_lambda_expr (t=, args=0x77171d80, complain=3, in_decl=0x77173800) at /usr/src/debug/gcc/gcc/cp/pt.cc:19855 tsubst_copy_and_build (t=, args=0x77171d80, complain=, in_decl=0x77177000, function_p=, integral_constant_expression_p=false) at /usr/src/debug/gcc/gcc/cp/pt.cc:21446 tsubst (t=0x771760a8, args=0x77171d80, complain=3, in_decl=0x77177000) at /usr/src/debug/gcc/gcc/cp/pt.cc:16400 tsubst_template_args (t=0x77171a20, args=args@entry=0x77171d80, complain=complain@entry=3, in_decl=in_decl@entry=0x77177000) at /usr/src/debug/gcc/gcc/cp/pt.cc:13580 [...] --- GCC 12.2.0, but GCC trunk on Compiler Explorer also exhibits the same issue (as do GCC 11.1, 11.2, 11.3, 12.1, and 12.2)
[Bug c++/105667] [C++20] lambas in template argument sometimes causes an ICE (seg fault)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667 Martin Liška changed: What|Removed |Added CC||jason at gcc dot gnu.org, ||marxin at gcc dot gnu.org --- Comment #5 from Martin Liška --- Likely started with r9-4045-g0c1e0d63fe0ceabb, it was rejected before the revision.
[Bug c++/105667] [C++20] lambas in template argument sometimes causes an ICE (seg fault)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2022-05-19 Ever confirmed|0 |1 --- Comment #4 from Andrew Pinski --- Confirmed. Another slightly more reduced testcase: template struct h {typedef int type;}; template struct t{}; template struct crash { using Types = typename h<[]() {}>::type; template static void f() { t b; }; }; int main() { crash<0>::f<1>(); return 0; }
[Bug c++/105667] [C++20] lambas in template argument sometimes causes an ICE (seg fault)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667 --- Comment #3 from Andrew Pinski --- here is one which removes the inner lamba to just a templated function inside a template struct: template struct h {typedef int type;}; template struct t{}; template struct crash { using Types = typename h<[]() {}>::type; template static void f() { using type = t; }; }; int main() { crash{}.f<1>(); return 0; }
[Bug c++/105667] [C++20] lambas in template argument sometimes causes an ICE (seg fault)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667 Andrew Pinski changed: What|Removed |Added Summary|[C++20] templated lambas in |[C++20] lambas in template |template argument sometimes |argument sometimes causes |causes an ICE (seg fault) |an ICE (seg fault) --- Comment #2 from Andrew Pinski --- Confirmed. something slightly shorter, changing the class template to a function template and changing some other things slightly too. problem is related to lamba as a template argument. template struct h {typedef int type;}; template struct t{}; template void crash() { using Types = typename h<[]() {}>::type; auto f = [&] () { using type = t; }; f.template operator()<1>(); } int main() { crash(); return 0; }