public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors
@ 2024-02-28 14:17 victor at westerhu dot is
  2024-02-28 14:40 ` [Bug libstdc++/114152] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: victor at westerhu dot is @ 2024-02-28 14:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114152
           Summary: Wrong exception specifiers for LFTSv3 scope guard
                    destructors
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: victor at westerhu dot is
  Target Milestone: ---

Created attachment 57560
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57560&action=edit
Patch

According to the (draft) specification of the C++ Extensions for Library
Fundamentals, Version 3
(https://cplusplus.github.io/fundamentals-ts/v3.html#scopeguard.exit), the
destructors of std::experimental::scope_{exit,failure} should be
unconditionally noexcept. The destructor of std::experimental::scope_success
should be noexcept if calling the exit function is noexcept.

The current implementation has noexcept(noexcept(this->_M_exit_function)) for
all three, which is wrong for all. It is even wrong for
std::experimental::scope_success, because it's missing the needed `()' for
actually testing the function call.

This error is present since the first addition of the scope guards. I have
attached the 3-line patch needed to fix this.

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

* [Bug libstdc++/114152] Wrong exception specifiers for LFTSv3 scope guard destructors
  2024-02-28 14:17 [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors victor at westerhu dot is
@ 2024-02-28 14:40 ` redi at gcc dot gnu.org
  2024-02-28 14:42 ` victor at westerhu dot is
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2024-02-28 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-02-28

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks - please send patches to the mailing list instead of attaching them
here.

https://gcc.gnu.org/contribute.html#patches

See https://gcc.gnu.org/contribute.html#legal as well.

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

* [Bug libstdc++/114152] Wrong exception specifiers for LFTSv3 scope guard destructors
  2024-02-28 14:17 [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors victor at westerhu dot is
  2024-02-28 14:40 ` [Bug libstdc++/114152] " redi at gcc dot gnu.org
@ 2024-02-28 14:42 ` victor at westerhu dot is
  2024-02-28 14:47 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: victor at westerhu dot is @ 2024-02-28 14:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Victor <victor at westerhu dot is> ---
Will do!

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

* [Bug libstdc++/114152] Wrong exception specifiers for LFTSv3 scope guard destructors
  2024-02-28 14:17 [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors victor at westerhu dot is
  2024-02-28 14:40 ` [Bug libstdc++/114152] " redi at gcc dot gnu.org
  2024-02-28 14:42 ` victor at westerhu dot is
@ 2024-02-28 14:47 ` redi at gcc dot gnu.org
  2024-02-28 14:50 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2024-02-28 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
   Target Milestone|---                         |13.3
             Status|NEW                         |ASSIGNED

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

* [Bug libstdc++/114152] Wrong exception specifiers for LFTSv3 scope guard destructors
  2024-02-28 14:17 [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors victor at westerhu dot is
                   ` (2 preceding siblings ...)
  2024-02-28 14:47 ` redi at gcc dot gnu.org
@ 2024-02-28 14:50 ` redi at gcc dot gnu.org
  2024-02-28 14:51 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2024-02-28 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I can take care of it this time, since I think I can figure out how to fix it
just from your detailed report :-) and I've already written a testcase:


// { dg-do compile { target c++20 } }

// PR libstdc++/114152
// Wrong exception specifiers for LFTSv3 scope guard destructors

#include <experimental/scope>

using namespace std::experimental;

struct F {
  void operator()() noexcept(false);
};

static_assert( noexcept(std::declval<scope_exit<F>&>().~scope_exit()) );
static_assert( noexcept(std::declval<scope_fail<F>&>().~scope_fail()) );
static_assert( ! noexcept(std::declval<scope_success<F>&>().~scope_success())
);

struct G {
  void operator()() noexcept(true);
};

static_assert( noexcept(std::declval<scope_exit<G>&>().~scope_exit()) );
static_assert( noexcept(std::declval<scope_fail<G>&>().~scope_fail()) );
static_assert( noexcept(std::declval<scope_success<G>&>().~scope_success()) );

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

* [Bug libstdc++/114152] Wrong exception specifiers for LFTSv3 scope guard destructors
  2024-02-28 14:17 [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors victor at westerhu dot is
                   ` (3 preceding siblings ...)
  2024-02-28 14:50 ` redi at gcc dot gnu.org
@ 2024-02-28 14:51 ` cvs-commit at gcc dot gnu.org
  2024-03-01 10:52 ` cvs-commit at gcc dot gnu.org
  2024-03-01 10:53 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-28 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:80c386cb20d38ebc55f30a79418fabfbed904b87

commit r14-9219-g80c386cb20d38ebc55f30a79418fabfbed904b87
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Feb 28 14:45:18 2024 +0000

    libstdc++: Fix noexcept on dtors in <experimental/scope> [PR114152]

    The PR points out that the destructors all have incorrect
    noexcept-specifiers.

    libstdc++-v3/ChangeLog:

            PR libstdc++/114152
            * include/experimental/scope (scope_exit scope_fail): Make
            destructor unconditionally noexcept.
            (scope_sucess): Fix noexcept-specifier.
            * testsuite/experimental/scopeguard/114152.cc: New test.

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

* [Bug libstdc++/114152] Wrong exception specifiers for LFTSv3 scope guard destructors
  2024-02-28 14:17 [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors victor at westerhu dot is
                   ` (4 preceding siblings ...)
  2024-02-28 14:51 ` cvs-commit at gcc dot gnu.org
@ 2024-03-01 10:52 ` cvs-commit at gcc dot gnu.org
  2024-03-01 10:53 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-01 10:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:89e7b77df1aefb01aadfacae83170b24a4c4d274

commit r13-8371-g89e7b77df1aefb01aadfacae83170b24a4c4d274
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Feb 28 14:45:18 2024 +0000

    libstdc++: Fix noexcept on dtors in <experimental/scope> [PR114152]

    The PR points out that the destructors all have incorrect
    noexcept-specifiers.

    libstdc++-v3/ChangeLog:

            PR libstdc++/114152
            * include/experimental/scope (scope_exit scope_fail): Make
            destructor unconditionally noexcept.
            (scope_sucess): Fix noexcept-specifier.
            * testsuite/experimental/scopeguard/114152.cc: New test.

    (cherry picked from commit 80c386cb20d38ebc55f30a79418fabfbed904b87)

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

* [Bug libstdc++/114152] Wrong exception specifiers for LFTSv3 scope guard destructors
  2024-02-28 14:17 [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors victor at westerhu dot is
                   ` (5 preceding siblings ...)
  2024-03-01 10:52 ` cvs-commit at gcc dot gnu.org
@ 2024-03-01 10:53 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2024-03-01 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 13.3 - thanks for the report.

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

end of thread, other threads:[~2024-03-01 10:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 14:17 [Bug libstdc++/114152] New: Wrong exception specifiers for LFTSv3 scope guard destructors victor at westerhu dot is
2024-02-28 14:40 ` [Bug libstdc++/114152] " redi at gcc dot gnu.org
2024-02-28 14:42 ` victor at westerhu dot is
2024-02-28 14:47 ` redi at gcc dot gnu.org
2024-02-28 14:50 ` redi at gcc dot gnu.org
2024-02-28 14:51 ` cvs-commit at gcc dot gnu.org
2024-03-01 10:52 ` cvs-commit at gcc dot gnu.org
2024-03-01 10:53 ` 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).