CMake/Source/Checks/cm_cxx_override.cxx
Daniel Pfeifer 3f77655d06 CM_OVERRIDE: fix feature test for clang
Clang refuses to default initialize an instance of a class that does not
have a default constructor.  Fix the check by adding default
constructors.  Don't use brace initialization like it is proposed in the
error message.  We want to test the override support independent from
the support for brace initialization.
2016-06-29 11:33:38 +02:00

25 lines
280 B
C++

struct Foo
{
Foo() {}
virtual ~Foo() {}
virtual int test() const = 0;
};
struct Bar : Foo
{
Bar() {}
~Bar() override {}
int test() const override { return 0; }
};
int test(Foo const& foo)
{
return foo.test();
}
int main()
{
Bar const bar;
return test(bar);
}