blob: 6601a3dd0d926ad1ef0983f957f498010c3cda43 [file] [log] [blame]
Shih-wei Liaof8fd82b2010-02-10 11:10:31 -08001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3int x(1);
4int (x2)(1);
5
6void f() {
7 int x(1);
8 int (x2)(1);
9 for (int x(1);;) {}
10}
11
12class Y {
13 explicit Y(float);
14};
15
16class X { // expected-note{{candidate constructor (the implicit copy constructor)}}
17public:
18 explicit X(int); // expected-note{{candidate constructor}}
19 X(float, float, float); // expected-note{{candidate constructor}}
20 X(float, Y); // expected-note{{candidate constructor}}
21};
22
23class Z { // expected-note{{candidate constructor (the implicit copy constructor)}}
24public:
25 Z(int); // expected-note{{candidate constructor}}
26};
27
28void g() {
29 X x1(5);
30 X x2(1.0, 3, 4.2);
31 X x3(1.0, 1.0); // expected-error{{no matching constructor for initialization of 'class X'}}
32 Y y(1.0);
33 X x4(3.14, y);
34
35 Z z; // expected-error{{no matching constructor for initialization of 'class Z'}}
36}
37
38struct Base {
39 operator int*() const;
40};
41
42struct Derived : Base {
43 operator int*(); // expected-note {{candidate function}}
44};
45
46void foo(const Derived cd, Derived d) {
47 int *pi = cd; // expected-error {{no viable conversion from 'struct Derived const' to 'int *'}}
48 int *ppi = d;
49
50}