diff options
Diffstat (limited to 'test/CXX/class.derived/class.abstract/p2.cpp')
-rw-r--r-- | test/CXX/class.derived/class.abstract/p2.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CXX/class.derived/class.abstract/p2.cpp b/test/CXX/class.derived/class.abstract/p2.cpp new file mode 100644 index 000000000000..713a5269f143 --- /dev/null +++ b/test/CXX/class.derived/class.abstract/p2.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -std=c++1z -verify %s + +// no objects of an abstract class can be created except as subobjects of a +// class derived from it + +struct A { + A() {} + A(int) : A() {} // ok + + virtual void f() = 0; // expected-note 1+{{unimplemented}} +}; + +void f(A &&a); + +void g() { + f({}); // expected-error {{abstract class}} + f({0}); // expected-error {{abstract class}} + f(0); // expected-error {{abstract class}} +} + +struct B : A { + B() : A() {} // ok +}; |