blob: c2ac77b30479b58e10830a73f1d2f2475e21dd60 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Sebastian Redl9ba73ad2009-01-09 19:57:06 +00002
3class A {
4 virtual void f();
5 virtual void g() = 0;
6
7 void h() = 0; // expected-error {{'h' is not virtual and cannot be declared pure}}
8 void i() = 1; // expected-error {{initializer on function does not look like a pure-specifier}}
9 void j() = 0u; // expected-error {{initializer on function does not look like a pure-specifier}}
10
Douglas Gregor021c3b32009-03-11 23:00:04 +000011
12 void k();
13
Sebastian Redl9ba73ad2009-01-09 19:57:06 +000014public:
15 A(int);
16};
17
Douglas Gregor021c3b32009-03-11 23:00:04 +000018virtual void A::k() { } // expected-error{{'virtual' can only be specified inside the class definition}}
19
Sebastian Redl9ba73ad2009-01-09 19:57:06 +000020class B : public A {
21 // Needs to recognize that overridden function is virtual.
22 //void g() = 0;
23
24 // Needs to recognize that function does not override.
25 //void g(int) = 0;
26};
27
28// Needs to recognize invalid uses of abstract classes.
29/*
30A fn(A)
31{
32 A a;
33 static_cast<A>(0);
34 try {
35 } catch(A) {
36 }
37}
38*/