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