https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108588
Bug ID: 108588
Summary: __is_constructible returns wrong value for invalid
(but non deleted) default constructor
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: roi.jacobson1 at gmail dot com
Target Milestone: ---
A weird edge case around is_constructible was reported to Clang at
https://github.com/llvm/llvm-project/issues/60293, and we think GCC might have
a bug around invalid and defaulted default constructors:
template <class T>
struct Wrapper {
T x = (void*)nullptr;
};
static_assert(!__is_constructible(Wrapper<int>));
This code currently compiles under GCC. But by [class.default.ctor#2.7],
Wrapper's default constructor is not deleted and so __is_constructible has no
business returning false - it should either return true or diagnose an error
while instantiating the default constructor that would not be in the immediate
context.