Douglas Gregor | 9ea416e | 2011-01-19 16:41:58 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s |
Sebastian Redl | ab963c6 | 2008-11-08 15:40:37 +0000 | [diff] [blame] | 2 | class C; |
Argyrios Kyrtzidis | 4cc18a4 | 2008-06-24 22:12:16 +0000 | [diff] [blame] | 3 | class C { |
| 4 | public: |
| 5 | protected: |
| 6 | typedef int A,B; |
| 7 | static int sf(), u; |
| 8 | |
| 9 | struct S {}; |
Douglas Gregor | a131d0f | 2010-07-13 06:24:26 +0000 | [diff] [blame] | 10 | enum {}; // expected-warning{{declaration does not declare anything}} |
Douglas Gregor | cb821d0 | 2010-04-08 21:33:23 +0000 | [diff] [blame] | 11 | int; // expected-warning {{declaration does not declare anything}} |
Argyrios Kyrtzidis | 3a9fdb4 | 2008-06-28 08:10:48 +0000 | [diff] [blame] | 12 | int : 1, : 2; |
Argyrios Kyrtzidis | 4cc18a4 | 2008-06-24 22:12:16 +0000 | [diff] [blame] | 13 | |
| 14 | public: |
| 15 | void m() { |
| 16 | int l = 2; |
Douglas Gregor | 9ea416e | 2011-01-19 16:41:58 +0000 | [diff] [blame] | 17 | }; |
| 18 | |
| 19 | template<typename T> void mt(T) { }; |
| 20 | ; // expected-warning{{extra ';' inside a class}} |
| 21 | |
Sebastian Redl | ab963c6 | 2008-11-08 15:40:37 +0000 | [diff] [blame] | 22 | virtual int vf() const volatile = 0; |
Argyrios Kyrtzidis | 4cc18a4 | 2008-06-24 22:12:16 +0000 | [diff] [blame] | 23 | |
| 24 | private: |
| 25 | int x,f(),y,g(); |
Sebastian Redl | ab963c6 | 2008-11-08 15:40:37 +0000 | [diff] [blame] | 26 | inline int h(); |
| 27 | static const int sci = 10; |
Sebastian Redl | 669d5d7 | 2008-11-14 23:42:31 +0000 | [diff] [blame] | 28 | mutable int mi; |
Argyrios Kyrtzidis | 4cc18a4 | 2008-06-24 22:12:16 +0000 | [diff] [blame] | 29 | }; |
Sebastian Redl | ab963c6 | 2008-11-08 15:40:37 +0000 | [diff] [blame] | 30 | void glo() |
| 31 | { |
| 32 | struct local {}; |
| 33 | } |
Chris Lattner | bc8d564 | 2008-12-18 01:12:00 +0000 | [diff] [blame] | 34 | |
| 35 | // PR3177 |
| 36 | typedef union { |
| 37 | __extension__ union { |
| 38 | int a; |
| 39 | float b; |
| 40 | } y; |
| 41 | } bug3177; |
| 42 | |
David Blaikie | 13f8daf | 2011-10-13 06:08:43 +0000 | [diff] [blame] | 43 | // check that we don't consume the token after the access specifier |
| 44 | // when it's not a colon |
| 45 | class D { |
| 46 | public // expected-error{{expected ':'}} |
| 47 | int i; |
| 48 | }; |
| 49 | |
| 50 | // consume the token after the access specifier if it's a semicolon |
| 51 | // that was meant to be a colon |
| 52 | class E { |
| 53 | public; // expected-error{{expected ':'}} |
| 54 | int i; |
| 55 | }; |
| 56 | |
| 57 | // PR11109 must appear at the end of the source file |
| 58 | class pr11109r3 { // expected-note{{to match this '{'}} |
| 59 | public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}} |