https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100476

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #2)
> (In reply to Iain Sandoe from comment #1)
> > I am by no means an expert at reading standardese - and it might be that I'm
> > not alone, (library writers might have made the same assumption) but it
> > seems to me that:
> > 
> > http://eel.is/c++draft/dcl.fct.def.coroutine#7
> > 
> > Doe not make any specification about what get_­return_­object() returns,
> > only that it is possible to use it either (a) to initialise the return value
> > directly or (b) to construct a return value object from it.
> 
> It says that you initialize the return value from get_return_object(), which
> sounds like
> 
>   return promise.get_return_object();
> 
> in a non-coroutine, which is an error if get_return_object returns void.

In general, you can't construct an object from a void expression; a void
expression can't be used as an operand for anything.

struct A { };

A a1 = A(); // default-initialize
A a2 = A((void)0); // error

Reply via email to