https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115859
Arsen Arsenović <arsen at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-08-28
Status|UNCONFIRMED |NEW
--- Comment #3 from Arsen Arsenović <arsen at gcc dot gnu.org> ---
needed light updates but still reproducible:
~$ cat mutant.C
namespace std {
template <typename a, typename> struct coroutine_traits {
using promise_type = a : promise_type;
} template <typename = void> struct coroutine_handle { static coroutine_handle
from_address(void*); void* address(); }
class b {
get_return_object()
} class c {
using promise_type = b;
};
__attribute__((optimize(3))) auto d(int awaitable) -> c {
co_await awaitable
~$ g++-15 mutant.C -g -std=c++20
mutant.C:3:26: error: found ‘:’ in nested-name-specifier, expected ‘::’
[-Wtemplate-body]
3 | using promise_type = a : promise_type;
| ^
| ::
mutant.C:4:2: error: expected ‘;’ after struct definition
4 | } template <typename = void> struct coroutine_handle { static
coroutine_handle from_address(void*); void* address(); }
| ^
| ;
mutant.C:4:119: error: expected ‘;’ after struct definition
4 | } template <typename = void> struct coroutine_handle { static
coroutine_handle from_address(void*); void* address(); }
|
^
|
;
mutant.C:6:3: error: ISO C++ forbids declaration of ‘get_return_object’ with no
type [-fpermissive]
6 | get_return_object()
| ^~~~~~~~~~~~~~~~~
mutant.C:6:21: error: expected ‘;’ at end of member declaration
6 | get_return_object()
| ^
| ;
mutant.C:7:2: error: expected ‘;’ after class definition
7 | } class c {
| ^
| ;
mutant.C: In instantiation of ‘struct std::coroutine_traits<std::c, int>’:
mutant.C:11:12: required from here
11 | co_await awaitable
| ^~~~~~~~~
mutant.C:3:9: error: ‘using std::c::promise_type = class std::b’ is private
within this context
3 | using promise_type = a : promise_type;
| ^~~~~~~~~~~~
mutant.C:8:9: note: declared private here
8 | using promise_type = b;
| ^~~~~~~~~~~~
mutant.C: In function ‘std::c std::d(int)’:
mutant.C:11:3: error: awaitable type ‘int’ is not a structure
11 | co_await awaitable
| ^~~~~~~~
mutant.C:11:21: error: expected ‘}’ at end of input
11 | co_await awaitable
| ^
mutant.C:10:57: note: to match this ‘{’
10 | __attribute__((optimize(3))) auto d(int awaitable) -> c {
| ^
mutant.C:10:35: error: no member named ‘initial_suspend’ in
‘std::coroutine_traits<std::c, int>::promise_type’ {aka ‘std::b’}
10 | __attribute__((optimize(3))) auto d(int awaitable) -> c {
| ^
mutant.C:10:35: error: no member named ‘unhandled_exception’ in
‘std::coroutine_traits<std::c, int>::promise_type’ {aka ‘std::b’}
mutant.C:10:35: error: no member named ‘final_suspend’ in
‘std::coroutine_traits<std::c, int>::promise_type’ {aka ‘std::b’}
mutant.C:11:21: error: ‘int std::b::get_return_object()’ is private within this
context
11 | co_await awaitable
| ^
mutant.C:6:3: note: declared private here
6 | get_return_object()
| ^~~~~~~~~~~~~~~~~
mutant.C:11:21: error: could not convert ‘_Coro_gro’ from ‘int’ to ‘std::c’
11 | co_await awaitable
| ^
| |
| int
mutant.C: At global scope:
mutant.C:11:21: error: expected ‘}’ at end of input
mutant.C:1:15: note: to match this ‘{’
1 | namespace std {
| ^
during GIMPLE pass: lower
mutant.C: In function ‘void std::d(d(int)::_ZSt1di.Frame*)’:
mutant.C:10:35: internal compiler error: in lower_stmt, at gimple-low.cc:724
10 | __attribute__((optimize(3))) auto d(int awaitable) -> c {
| ^
0x558b82c52947 internal_error(char const*, ...)
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/diagnostic-global-context.cc:491
0x558b82c52ae7 fancy_abort(char const*, int, char const*)
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/diagnostic.cc:1772
0x558b8158540e lower_stmt
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:724
0x558b8158540e lower_sequence
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:229
0x558b8378ffbd lower_gimple_bind
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:918
0x558b82f811f7 lower_stmt
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:667
0x558b82f811f7 lower_sequence
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:229
0x558b82f8136b lower_try_catch
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:946
0x558b82f8136b lower_stmt
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:693
0x558b82f8136b lower_sequence
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:229
0x558b8378ffbd lower_gimple_bind
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:918
0x558b82f811f7 lower_stmt
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:667
0x558b82f811f7 lower_sequence
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:229
0x558b82f8121e lower_stmt
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:698
0x558b82f8121e lower_sequence
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:229
0x558b8378ffbd lower_gimple_bind
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:918
0x558b82f7ae16 lower_function_body
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:119
0x558b82f7ae16 execute
/usr/src/debug/sys-devel/gcc-15.0.0_pre20240818/gcc-15-20240818/gcc/gimple-low.cc:206
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
~ 1 $