2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s
|
2008-11-01 04:25:05 +08:00
|
|
|
typedef int INT;
|
|
|
|
|
2008-10-31 17:07:45 +08:00
|
|
|
class Foo {
|
|
|
|
Foo();
|
|
|
|
(Foo)(float) { }
|
2008-11-24 07:12:31 +08:00
|
|
|
explicit Foo(int); // expected-note {{previous declaration is here}}
|
2008-10-31 17:07:45 +08:00
|
|
|
Foo(const Foo&);
|
|
|
|
|
2008-11-01 04:25:05 +08:00
|
|
|
((Foo))(INT); // expected-error{{cannot be redeclared}}
|
|
|
|
|
|
|
|
Foo(Foo foo, int i = 17, int j = 42); // expected-error {{copy constructor must pass its first argument by reference}}
|
|
|
|
|
2008-10-31 17:07:45 +08:00
|
|
|
static Foo(short, short); // expected-error{{constructor cannot be declared 'static'}}
|
|
|
|
virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}}
|
|
|
|
Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}}
|
|
|
|
|
|
|
|
int Foo(int, int); // expected-error{{constructor cannot have a return type}}
|
|
|
|
};
|
2008-12-12 16:25:50 +08:00
|
|
|
|
|
|
|
Foo::Foo(const Foo&) { }
|
|
|
|
|
2008-12-16 05:24:18 +08:00
|
|
|
typedef struct {
|
|
|
|
int version;
|
|
|
|
} Anon;
|
|
|
|
extern const Anon anon;
|
|
|
|
extern "C" const Anon anon2;
|
|
|
|
|
2008-12-24 00:41:32 +08:00
|
|
|
// PR3188: The extern declaration complained about not having an appropriate
|
|
|
|
// constructor.
|
|
|
|
struct x;
|
|
|
|
extern x a;
|
|
|
|
|
|
|
|
// A similar case.
|
|
|
|
struct y {
|
|
|
|
y(int);
|
|
|
|
};
|
|
|
|
extern y b;
|
2008-12-24 08:01:03 +08:00
|
|
|
|
|
|
|
struct Length {
|
|
|
|
Length l() const { return *this; }
|
|
|
|
};
|