1// RUN: %clang_cc1 -fsyntax-only -verify %s 2typedef int INT; 3 4class 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 20 volatile Foo(float); // expected-error{{constructor cannot have a return type}} 21}; 22 23Foo::Foo(const Foo&) { } 24 25typedef struct { 26 int version; 27} Anon; 28extern const Anon anon; 29extern "C" const Anon anon2; 30 31// PR3188: The extern declaration complained about not having an appropriate 32// constructor. 33struct x; 34extern x a; 35 36// A similar case. 37struct y { 38 y(int); 39}; 40extern y b; 41 42struct Length { 43 Length l() const { return *this; } 44}; 45 46// <rdar://problem/6815988> 47struct mmst_reg{ 48 char mmst_reg[10]; 49}; 50 51// PR3948 52namespace PR3948 { 53// PR3948 54class a { 55 public: 56 int b(int a()); 57}; 58int x(); 59void y() { 60 a z; z.b(x); 61} 62} 63 64namespace A { 65 struct S { 66 S(); 67 S(int); 68 void f1(); 69 void f2(); 70 operator int (); 71 ~S(); 72 }; 73} 74 75A::S::S() {} 76 77void A::S::f1() {} 78 79struct S {}; 80 81A::S::S(int) {} 82 83void A::S::f2() {} 84 85A::S::operator int() { return 1; } 86 87A::S::~S() {} 88 89