llvm-for-llvmta/tools/clang/test/CXX/class.derived/class.abstract/p2.cpp

24 lines
461 B
C++
Raw Permalink Normal View History

2022-04-25 13:02:35 +02:00
// 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
};