Created attachment 55032 [details] the result of -freport-bug Compile the attached test_when_all.i.cpp with: g++ -std=c++20 -fext-numeric-literals -Wno-non-template-friend \ test_when_all.i.cpp Result: In file included from /home/eniebler/Code/stdexec/include/stdexec/execution.hpp:35, from /home/eniebler/Code/stdexec/test/stdexec/algos/adaptors/test_when_all.cpp:18: /home/eniebler/Code/stdexec/include/stdexec/__detail/__tuple.hpp: In instantiation of ‘constexpr stdexec::__tup::__tuple_for<_Ts ...> stdexec::__tup::__make_tuple_fn::operator()(_Ts ...) const [with _Ts = {____C_A_T_C_H____T_E_S_T____24()::<lambda(int, int, int)>}]’: /home/eniebler/Code/stdexec/include/stdexec/__detail/__tuple.hpp:284:37: required from here /home/eniebler/Code/stdexec/include/stdexec/__detail/__tuple.hpp:284:37: internal compiler error: in write_member_name, at cp/mangle.cc:2992 284 | constexpr __tuple_for<_Ts...> operator()(_Ts... __ts) const | ^~~~~~~~ 0x9acf33 write_member_name ../../gcc/cp/mangle.cc:2992 0x9ace8f write_member_name ../../gcc/cp/mangle.cc:2999 0x9ad8ce write_expression ../../gcc/cp/mangle.cc:3668 0x9adecc write_expression ../../gcc/cp/mangle.cc:3592 0x9b290c write_type ../../gcc/cp/mangle.cc:2489 0x9b198c write_template_args ../../gcc/cp/mangle.cc:2966 0x9b7e2f write_nested_name ../../gcc/cp/mangle.cc:1154 0x9b26de write_class_enum_type ../../gcc/cp/mangle.cc:2937 0x9b26de write_type ../../gcc/cp/mangle.cc:2362 0x9b6739 write_bare_function_type ../../gcc/cp/mangle.cc:2856 0x9b699b write_mangled_name ../../gcc/cp/mangle.cc:799 0x9b8827 mangle_decl_string ../../gcc/cp/mangle.cc:4143 0x9b8ac8 get_mangled_id ../../gcc/cp/mangle.cc:4164 0x9b8ac8 mangle_decl(tree_node*) ../../gcc/cp/mangle.cc:4202 0x15934b5 decl_assembler_name(tree_node*) ../../gcc/tree.cc:715 0x15c6d59 assign_assembler_name_if_needed(tree_node*) ../../gcc/tree.cc:830 0xd126f1 cgraph_node::analyze() ../../gcc/cgraphunit.cc:677 0xd15f7a analyze_functions ../../gcc/cgraphunit.cc:1247 0xd170ed symbol_table::finalize_compilation_unit() ../../gcc/cgraphunit.cc:2554 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.
Possible dupe of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100632
reducing ...
(In reply to Eric Niebler from comment #1) > Possible dupe of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100632 It is unrelated. it seems more lambda related while I am reducing it.
Reduced: ``` auto ll = [](auto ... ){}; template <class _Impl, class _Args> void mm(void (_Impl::*__p)(_Args) const); template <class _Ts> using __impl_for = decltype(mm(&decltype(ll)::operator()<_Ts>)); template <class _Ts> __impl_for<_Ts> f() { } void aaa() { f<int>(); } ``` as far as I can tell the above is valid C++17 code. It was rejected in 10.1.0, 9.3.0 8.5.0 and started to ICE in 11.1.0. But it was accepted in 10.3.0 10.4.0 9.5.0 9.4.0.
In GCC 11, the code in comment 4 started to be accepted with r11-2420: commit 2c58f5cadfac338a67723fd6e41c9097760c4a33 Author: Patrick Palka <ppalka@redhat.com> Date: Wed Jul 29 22:06:44 2020 -0400 c++: overload sets and placeholder return type [PR64194] and started to ICE with r11-6301: commit 027935eec43173a89cd3eeace0b51967288ac075 Author: Jason Merrill <jason@redhat.com> Date: Mon Dec 21 17:31:16 2020 -0500 c++: Add some asserts in mangle.c
Here's a non-lambda version that ICEs in the same spot: struct A { template<class T> void operator+(T); }; template<class T> decltype(&A::operator+<T>) f(); int main() { f<int>(); }
GCC 11.4 is being released, retargeting bugs to GCC 11.5.
GCC 11 branch is being closed.
Working on this one.
The master branch has been updated by Simon Martin <simartin@gcc.gnu.org>: https://gcc.gnu.org/g:a030fcad4f9f490a08db0a4cad4c22635a0585c1 commit r15-3797-ga030fcad4f9f490a08db0a4cad4c22635a0585c1 Author: Simon Martin <simon@nasilyan.com> Date: Mon Sep 16 13:45:32 2024 +0200 c++: Don't crash when mangling member with anonymous union or template type [PR100632, PR109790] We currently crash upon mangling members that have an anonymous union or a template operator type. The problem is that before calling write_unqualified_name, write_member_name asserts that it has a declaration whose DECL_NAME is an identifier node that is not that of an operator. This is wrong: - In PR100632, it's an anonymous union declaration, hence a 0 DECL_NAME - In PR109790, it's a legitimate template declaration for an operator (this was accepted up to GCC 10) This assert was added via r11-6301, to be sure that we do write the "on" marker for operator members. This patch removes that assert and instead - Lets members with an anonymous union type go through - For operators, adds the missing "on" marker for ABI versions greater than the highest usable with GCC 10 PR c++/109790 PR c++/100632 gcc/cp/ChangeLog: * mangle.cc (write_member_name): Handle members whose type is an anonymous union member. Write missing "on" marker for operators when ABI version is at least 16. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/decltype83.C: New test. * g++.dg/cpp0x/decltype83a.C: New test. * g++.dg/cpp1y/lambda-ice3.C: New test. * g++.dg/cpp1y/lambda-ice3a.C: New test. * g++.dg/cpp2a/nontype-class67.C: New test.
Fixed in GCC 15.