xref: /minix3/external/bsd/llvm/dist/clang/test/CXX/class.derived/class.abstract/p5.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct A {
4*f4a2713aSLionel Sambuc   virtual void f() = 0; // expected-note{{unimplemented pure virtual method}}
5*f4a2713aSLionel Sambuc };
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc struct B : A {
8*f4a2713aSLionel Sambuc   virtual void f();
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc struct C : B {
12*f4a2713aSLionel Sambuc   virtual void f() = 0; // expected-note 2{{unimplemented pure virtual method}}
13*f4a2713aSLionel Sambuc };
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc struct D : C {
16*f4a2713aSLionel Sambuc };
17*f4a2713aSLionel Sambuc 
test()18*f4a2713aSLionel Sambuc void test() {
19*f4a2713aSLionel Sambuc   (void)new A; // expected-error{{abstract class}}
20*f4a2713aSLionel Sambuc   (void)new B;
21*f4a2713aSLionel Sambuc   (void)new C; // expected-error{{abstract class}}
22*f4a2713aSLionel Sambuc   (void)new D; // expected-error{{abstract class}}
23*f4a2713aSLionel Sambuc }
24