2009-03-24 05:24:46 +03:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s
|
2008-10-31 23:25:05 +03:00
|
|
|
typedef int INT;
|
|
|
|
|
2008-10-31 12:07:45 +03:00
|
|
|
class Foo {
|
|
|
|
Foo();
|
|
|
|
(Foo)(float) { }
|
2008-11-24 02:12:31 +03:00
|
|
|
explicit Foo(int); // expected-note {{previous declaration is here}}
|
2008-10-31 12:07:45 +03:00
|
|
|
Foo(const Foo&);
|
|
|
|
|
2008-10-31 23:25:05 +03:00
|
|
|
((Foo))(INT); // expected-error{{cannot be redeclared}}
|
|
|
|
|
2009-03-27 07:38:56 +03:00
|
|
|
Foo(Foo foo, int i = 17, int j = 42); // expected-error{{copy constructor must pass its first argument by reference}}
|
2008-10-31 23:25:05 +03:00
|
|
|
|
2008-10-31 12:07:45 +03: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 11:25:50 +03:00
|
|
|
|
|
|
|
Foo::Foo(const Foo&) { }
|
|
|
|
|
2008-12-16 00:24:18 +03:00
|
|
|
typedef struct {
|
|
|
|
int version;
|
|
|
|
} Anon;
|
|
|
|
extern const Anon anon;
|
|
|
|
extern "C" const Anon anon2;
|
|
|
|
|
2008-12-23 19:41:32 +03: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 03:01:03 +03:00
|
|
|
|
|
|
|
struct Length {
|
|
|
|
Length l() const { return *this; }
|
|
|
|
};
|