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

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Michael Bruck from comment #3)
> I think you misread, I was complaining about it passing the closure to the
> traits/constructor/allocator. But if that is what was agreed upon...
> 
> Can the closure object that is being passed to the constructor and allocator
> be used for anything? I am asking because I got it to pass nullptr with the
> code below. But if there is no legitimate use it might as well always pass a
> nullptr.

OK.. I think I did misread (I was under the impression you wanted better
diagnostics for the case where the user had intentionally specialised the
traits - but made an error). [FTR, I am not sure if that's feasible - but
someone with more specialisation-fu can comment on that].

---

I think we need the closure object type in the traits lookup because:

Since the coroutine traits are global, and the closure type is unique, that
provides a way to disambiguate instantiations of the traits for lambdas with
otherwise identical signatures.

The callable is usable in the other positions - I don't think that was
particularly in debate.

The issue was about whether we should pass a reference to the closure or the
pointer (and it was decided that symmetry with the class object that a
reference was the intention).

The fix is not yet in master (to make it a reference) - it's pending review
(but you could apply it to test things out).

Reply via email to