aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/class.derived/class.abstract/p2.cpp
blob: 713a5269f1431ed8cc86b9f0e7c7799c420dc87e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
};