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