[Bug c++/94517] incorrect use of enable_if compiles but should not
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 17 08:31:16 GMT 2021
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;
}
More information about the Gcc-bugs
mailing list