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

--- Comment #4 from Thomas Rodgers <rodgertq at gcc dot gnu.org> ---
(In reply to Jiang An from comment #3)
> > is_nothrow_invocable_v<CompletionFunction&> shall be true.
> 
> If implementation divergence is not intendedly permitted, I don't think it
> makes much sense to introduce UB in this way.
> 
> I guess we should either turn it into a mandating requirement:
> > Instantiation of barrier<CompletionFunction> is ill-formed
> > if is_nothrow_invocable_v<CompletionFunction&> is not true.
> 
> Or relax the preconditions:
> > If any invocation to the completion function throws an exception,
> > the behavior is undefined.
> 
> I've mailed to LWG Chair for this...

LWG Chair has already weighed in on this thread.

libstdc++ and libc++ have essentially the same implementation of std::barrier
(libstdc++'s implementation is derived from libc++'s). So that they behave
consistently and MSVC is different is not surprising.

I don't have a strong opinion on whether this should be UB ore mandated.
Raising an LWG issue seems reasonable.

Reply via email to