2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s
|
2008-10-07 01:10:33 +08:00
|
|
|
|
|
|
|
int x(1);
|
2008-10-07 18:21:57 +08:00
|
|
|
int (x2)(1);
|
2008-10-07 01:10:33 +08:00
|
|
|
|
|
|
|
void f() {
|
|
|
|
int x(1);
|
2008-12-18 00:19:15 +08:00
|
|
|
int (x2)(1);
|
2008-10-07 01:10:33 +08:00
|
|
|
for (int x(1);;) {}
|
|
|
|
}
|
2008-11-04 04:45:27 +08:00
|
|
|
|
|
|
|
class Y {
|
|
|
|
explicit Y(float);
|
|
|
|
};
|
|
|
|
|
|
|
|
class X { // expected-note{{candidate function}}
|
|
|
|
public:
|
|
|
|
explicit X(int); // expected-note{{candidate function}}
|
|
|
|
X(float, float, float); // expected-note{{candidate function}}
|
|
|
|
X(float, Y); // expected-note{{candidate function}}
|
|
|
|
};
|
|
|
|
|
2008-11-05 23:29:30 +08:00
|
|
|
class Z {
|
2008-11-04 04:45:27 +08:00
|
|
|
public:
|
2008-11-05 23:29:30 +08:00
|
|
|
Z(int);
|
2008-11-04 04:45:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void g() {
|
|
|
|
X x1(5);
|
|
|
|
X x2(1.0, 3, 4.2);
|
|
|
|
X x3(1.0, 1.0); // expected-error{{no matching constructor for initialization of 'x3'; candidates are:}}
|
|
|
|
Y y(1.0);
|
|
|
|
X x4(3.14, y);
|
|
|
|
|
2008-11-05 23:29:30 +08:00
|
|
|
Z z; // expected-error{{no matching constructor for initialization of 'z'}}
|
2008-11-04 04:45:27 +08:00
|
|
|
}
|
2009-09-16 03:12:21 +08:00
|
|
|
|
|
|
|
struct Base {
|
2009-09-16 06:15:23 +08:00
|
|
|
operator int*() const;
|
2009-09-16 03:12:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Derived : Base {
|
2009-09-16 06:15:23 +08:00
|
|
|
operator int*();
|
2009-09-16 03:12:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void foo(const Derived cd, Derived d) {
|
2009-09-16 06:15:23 +08:00
|
|
|
int *pi = cd; // expected-error {{incompatible type initializing 'struct Derived const', expected 'int *'}}
|
|
|
|
int *ppi = d;
|
2009-09-16 03:12:21 +08:00
|
|
|
|
|
|
|
}
|