In the following simple code fragment:
#include <cstddef>
struct B
{
virtual ~B() = default;
static void operator delete(void *, int);
static void * operator new(size_t, int);
};
struct C : B
{
virtual ~C() = default;
};
clang 3.7 complains that "non-deleted function '~C' cannot override a deleted function": http://goo.gl/Ax6oth
Neither Visual Studio nor GCC report an error in this code. Is it a clang defect or what?
No, it's
and that type difference causes an ambiguity that gets relevant:
cppreference.com has
And in the standard (draft n4140) §12.4 that is
I encountered same problem. @decltype_auto said it's a C++11 feature. So I use option "-std=c++98" to bypass the problem.