[Bug libstdc++/87538] New: Incorrect noexcept specifier for not_fn
barry.revzin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 5 21:20:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87538
Bug ID: 87538
Summary: Incorrect noexcept specifier for not_fn
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Found by Edgar Rokjān (https://stackoverflow.com/q/52673235/2069064). The
noexcept specifier for _Not_fn currently only checks the noexcept-ness of
applying the ! operator on the return type, not of the actual call:
noexcept(noexcept(_S_not<__inv_res_t<_Fn _QUALS, _Args...>>()))
As a result, this fails:
#include <functional>
struct X {
int operator()(int);
};
static_assert(!noexcept(
std::not_fn(X{})(2)));
While not_fn isn't actually specified to have any kind of noexcept-specifier,
this one seems actively wrong - either it should propagate through the type's
actual call function (so the above assert shouldn't trigger) or it should never
be noexcept (likewise).
More information about the Gcc-bugs
mailing list