https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90814
Bug ID: 90814
Summary: gcc accept invalid constexpr defaulted constructor
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tyker at outlook dot com
Target Milestone: ---
with gcc, the following code doesn't emit an error if INCORRECT is set.
struct A {
A() {}
};
template<typename T = int>
struct D : A {
#ifdef INCORRECT
int& r;
#endif
};
struct B {
D<> d;
constexpr B() = default;
};
example : https://godbolt.org/z/oAVthP