Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Sebastian Redl | 9ba73ad | 2009-01-09 19:57:06 +0000 | [diff] [blame] | 2 | |
| 3 | class 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 Gregor | 021c3b3 | 2009-03-11 23:00:04 +0000 | [diff] [blame] | 11 | |
| 12 | void k(); |
| 13 | |
Sebastian Redl | 9ba73ad | 2009-01-09 19:57:06 +0000 | [diff] [blame] | 14 | public: |
| 15 | A(int); |
| 16 | }; |
| 17 | |
Douglas Gregor | 021c3b3 | 2009-03-11 23:00:04 +0000 | [diff] [blame] | 18 | virtual void A::k() { } // expected-error{{'virtual' can only be specified inside the class definition}} |
| 19 | |
Sebastian Redl | 9ba73ad | 2009-01-09 19:57:06 +0000 | [diff] [blame] | 20 | class 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 | /* |
| 30 | A fn(A) |
| 31 | { |
| 32 | A a; |
| 33 | static_cast<A>(0); |
| 34 | try { |
| 35 | } catch(A) { |
| 36 | } |
| 37 | } |
| 38 | */ |