1// RUN: %clang_cc1 -fsyntax-only -verify %s 2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 4 5int x(1); 6int (x2)(1); 7 8void f() { 9 int x(1); 10 int (x2)(1); 11 for (int x(1);;) {} 12} 13 14class Y { 15public: explicit Y(float); 16}; 17 18class X { // expected-note{{candidate constructor (the implicit copy constructor)}} 19#if __cplusplus >= 201103L // C++11 or later 20// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} 21#endif 22 23public: 24 explicit X(int); // expected-note{{candidate constructor}} 25 X(float, float, float); // expected-note{{candidate constructor}} 26 X(float, Y); // expected-note{{candidate constructor}} 27}; 28 29class Z { // expected-note{{candidate constructor (the implicit copy constructor)}} 30#if __cplusplus >= 201103L // C++11 or later 31// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}} 32#endif 33 34public: 35 Z(int); // expected-note{{candidate constructor}} 36}; 37 38void g() { 39 X x1(5); 40 X x2(1.0, 3, 4.2); 41 X x3(1.0, 1.0); // expected-error{{no matching constructor for initialization of 'X'}} 42 Y y(1.0); 43 X x4(3.14, y); 44 45 Z z; // expected-error{{no matching constructor for initialization of 'Z'}} 46} 47 48struct Base { 49 operator int*() const; 50}; 51 52struct Derived : Base { 53 operator int*(); // expected-note {{candidate function}} 54}; 55 56void foo(const Derived cd, Derived d) { 57 int *pi = cd; // expected-error {{no viable conversion from 'const Derived' to 'int *'}} 58 int *ppi = d; 59 60} 61