• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
2 class C;
3 class C {
4 public:
5 protected:
6   typedef int A,B;
7   static int sf(), u;
8 
9   struct S {};
10   enum {}; // expected-warning{{declaration does not declare anything}}
11   int; // expected-warning {{declaration does not declare anything}}
12   int : 1, : 2;
13 
14 public:
m()15   void m() {
16     int l = 2;
17   };
18 
mt(T)19   template<typename T> void mt(T) { };
20   ; // expected-warning{{extra ';' inside a class}}
21 
22   virtual int vf() const volatile = 0;
23 
24 private:
25   int x,f(),y,g();
26   inline int h();
27   static const int sci = 10;
28   mutable int mi;
29 };
glo()30 void glo()
31 {
32   struct local {};
33 }
34 
35 // PR3177
36 typedef union {
37   __extension__ union {
38     int a;
39     float b;
40   } y;
41 } bug3177;
42 
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 class F {
58     int F1 { return 1; } // expected-error{{function definition does not declare parameters}}
59     void F2 {} // expected-error{{function definition does not declare parameters}}
60     typedef int F3() { return 0; } // expected-error{{function definition declared 'typedef'}}
F4()61     typedef void F4() {} // expected-error{{function definition declared 'typedef'}}
62 };
63 
64 namespace ctor_error {
65   class Foo {};
66   // By [class.qual]p2, this is a constructor declaration.
67   Foo::Foo (F) = F(); // expected-error{{does not match any declaration in 'ctor_error::Foo'}}
68 
69   class Ctor { // expected-note{{not complete until the closing '}'}}
70     Ctor(f)(int); // ok
71     Ctor(g(int)); // ok
72     Ctor(x[5]); // expected-error{{incomplete type}}
73 
74     Ctor(UnknownType *); // expected-error{{unknown type name 'UnknownType'}}
75     void operator+(UnknownType*); // expected-error{{unknown type name 'UnknownType'}}
76   };
77 
78   Ctor::Ctor (x) = { 0 }; // \
79     // expected-error{{qualified reference to 'Ctor' is a constructor name}}
80 
Ctor(UnknownType *)81   Ctor::Ctor(UnknownType *) {} // \
82     // expected-error{{unknown type name 'UnknownType'}}
operator +(UnknownType *)83   void Ctor::operator+(UnknownType*) {} // \
84     // expected-error{{unknown type name 'UnknownType'}}
85 }
86 
87 // PR11109 must appear at the end of the source file
88 class pr11109r3 { // expected-note{{to match this '{'}}
89   public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}}
90