[Bug c++/107256] New: Contradictory circular noexcept-specifier is accepted
de34 at live dot cn
gcc-bugzilla@gcc.gnu.org
Fri Oct 14 02:06:58 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107256
Bug ID: 107256
Summary: Contradictory circular noexcept-specifier is accepted
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
This code snipet is currently accepted by gcc while the noexcept-specifier
cannot be meaningful.
struct Weird {
static void f() noexcept(!noexcept(Weird::f())) {}
};
Godbolt link: https://godbolt.org/z/hqnha3aPd
The code was rejected by gcc 9 and earlier versions, but with a seemly
incorrect reason (error: incomplete type 'Weird' used in nested name
specifier). According to CWG DR 1330 and current wording in [class.mem.general]
/7, the noexcept-specifier establishes a complete-class context, so Weird is
complete inside it.
More information about the Gcc-bugs
mailing list