public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept
@ 2023-02-28 19:23 oliver.rosten at googlemail dot com
  2023-02-28 19:24 ` [Bug libstdc++/108974] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: oliver.rosten at googlemail dot com @ 2023-02-28 19:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108974
           Summary: std::barrier except completion function which is not
                    manifestly noexcept
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oliver.rosten at googlemail dot com
  Target Milestone: ---

std::barrier<std::function<void()>> b{1, [](){}};

is accepted by gcc (and clang).

However, it fails on MSVC - as I think it should - since std::function's call
operator isn't manifestly noexcept.

https://godbolt.org/z/7vfoa1qhn

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108974] std::barrier except completion function which is not manifestly noexcept
  2023-02-28 19:23 [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept oliver.rosten at googlemail dot com
@ 2023-02-28 19:24 ` pinskia at gcc dot gnu.org
  2023-02-28 21:16 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-28 19:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 54558
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54558&action=edit
Full testcase

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108974] std::barrier except completion function which is not manifestly noexcept
  2023-02-28 19:23 [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept oliver.rosten at googlemail dot com
  2023-02-28 19:24 ` [Bug libstdc++/108974] " pinskia at gcc dot gnu.org
@ 2023-02-28 21:16 ` redi at gcc dot gnu.org
  2023-02-28 21:17 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-28 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-28
                 CC|                            |rodgertq at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108974] std::barrier except completion function which is not manifestly noexcept
  2023-02-28 19:23 [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept oliver.rosten at googlemail dot com
  2023-02-28 19:24 ` [Bug libstdc++/108974] " pinskia at gcc dot gnu.org
  2023-02-28 21:16 ` redi at gcc dot gnu.org
@ 2023-02-28 21:17 ` redi at gcc dot gnu.org
  2023-03-02  2:27 ` de34 at live dot cn
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-28 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
"is_nothrow_invocable_v<CompletionFunction&> shall be true."

Failing to meet that requirement is undefined, so we're not required to reject
it as ill-formed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108974] std::barrier except completion function which is not manifestly noexcept
  2023-02-28 19:23 [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept oliver.rosten at googlemail dot com
                   ` (2 preceding siblings ...)
  2023-02-28 21:17 ` redi at gcc dot gnu.org
@ 2023-03-02  2:27 ` de34 at live dot cn
  2023-03-02  2:38 ` rodgertq at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: de34 at live dot cn @ 2023-03-02  2:27 UTC (permalink / raw)
  To: gcc-bugs

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

Jiang An <de34 at live dot cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |de34 at live dot cn

--- Comment #3 from Jiang An <de34 at live dot cn> ---
> 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...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108974] std::barrier except completion function which is not manifestly noexcept
  2023-02-28 19:23 [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept oliver.rosten at googlemail dot com
                   ` (3 preceding siblings ...)
  2023-03-02  2:27 ` de34 at live dot cn
@ 2023-03-02  2:38 ` rodgertq at gcc dot gnu.org
  2023-03-02  2:43 ` rodgertq at gcc dot gnu.org
  2023-03-02  9:58 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rodgertq at gcc dot gnu.org @ 2023-03-02  2:38 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108974] std::barrier except completion function which is not manifestly noexcept
  2023-02-28 19:23 [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept oliver.rosten at googlemail dot com
                   ` (4 preceding siblings ...)
  2023-03-02  2:38 ` rodgertq at gcc dot gnu.org
@ 2023-03-02  2:43 ` rodgertq at gcc dot gnu.org
  2023-03-02  9:58 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rodgertq at gcc dot gnu.org @ 2023-03-02  2:43 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Rodgers <rodgertq at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rodgertq at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/108974] std::barrier except completion function which is not manifestly noexcept
  2023-02-28 19:23 [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept oliver.rosten at googlemail dot com
                   ` (5 preceding siblings ...)
  2023-03-02  2:43 ` rodgertq at gcc dot gnu.org
@ 2023-03-02  9:58 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-03-02  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jiang An from comment #3)
> I've mailed to LWG Chair for this...

Thanks, the new issue will be opened soon.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-02  9:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 19:23 [Bug c++/108974] New: std::barrier except completion function which is not manifestly noexcept oliver.rosten at googlemail dot com
2023-02-28 19:24 ` [Bug libstdc++/108974] " pinskia at gcc dot gnu.org
2023-02-28 21:16 ` redi at gcc dot gnu.org
2023-02-28 21:17 ` redi at gcc dot gnu.org
2023-03-02  2:27 ` de34 at live dot cn
2023-03-02  2:38 ` rodgertq at gcc dot gnu.org
2023-03-02  2:43 ` rodgertq at gcc dot gnu.org
2023-03-02  9:58 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).