https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94517
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is we don't instantiate the constructor until we need it as shown by:
#include <functional>
struct NoDefault
{
NoDefault() = delete;
};
// compiles while should not
struct X : public NoDefault
{
template<std::enable_if_t
<
std::is_default_constructible_v
<
NoDefault
>
>* = nullptr>
X() : NoDefault{}
{
// static_assert(std::is_default_constructible_v<NoDefault>);
}
};
void f(void)
{
X x;
}