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.

Reply via email to