Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 typedef int INT;
      3 
      4 class Foo {
      5   Foo();
      6   (Foo)(float) { }
      7   explicit Foo(int); // expected-note {{previous declaration is here}}
      8   Foo(const Foo&);
      9 
     10   ((Foo))(INT); // expected-error{{cannot be redeclared}}
     11 
     12   Foo(Foo foo, int i = 17, int j = 42); // expected-error{{copy constructor must pass its first argument by reference}}
     13 
     14   static Foo(short, short); // expected-error{{constructor cannot be declared 'static'}}
     15   virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}}
     16   Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}}
     17 
     18   int Foo(int, int); // expected-error{{constructor cannot have a return type}} \
     19   // expected-error{{member 'Foo' has the same name as its class}}
     20 
     21   volatile Foo(float); // expected-error{{constructor cannot have a return type}}
     22 };
     23 
     24 Foo::Foo(const Foo&) { }
     25 
     26 typedef struct {
     27   int version;
     28 } Anon;
     29 extern const Anon anon;
     30 extern "C" const Anon anon2;
     31 
     32 // PR3188: The extern declaration complained about not having an appropriate
     33 // constructor.
     34 struct x;
     35 extern x a;
     36 
     37 // A similar case.
     38 struct y {
     39   y(int);
     40 };
     41 extern y b;
     42 
     43 struct Length {
     44   Length l() const { return *this; }
     45 };
     46 
     47 // <rdar://problem/6815988>
     48 struct mmst_reg{
     49  char mmst_reg[10];
     50 };
     51 
     52 // PR3948
     53 namespace PR3948 {
     54 // PR3948
     55 class a {
     56   public:
     57   int b(int a());
     58 };
     59 int x();
     60 void y() {
     61   a z; z.b(x);
     62 }
     63 }
     64 
     65 namespace A {
     66   struct S {
     67     S();
     68     S(int);
     69     void f1();
     70     void f2();
     71     operator int ();
     72     ~S();
     73   };
     74 }
     75 
     76 A::S::S() {}
     77 
     78 void A::S::f1() {}
     79 
     80 struct S {};
     81 
     82 A::S::S(int) {}
     83 
     84 void A::S::f2() {}
     85 
     86 A::S::operator int() { return 1; }
     87 
     88 A::S::~S() {}
     89 
     90