brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · d66e09e Raw
55 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5class Z { };6 7class Y { 8public:9  Y(const Z&);10};11 12class X {13public:14  X(int);15  X(const Y&);16};17 18void f(X); // expected-note{{candidate function}}19 20void g(short s, Y y, Z z) {21  f(s);22  f(1.0f);23  f(y);24  f(z); // expected-error{{no matching function}}25}26 27 28class FromShort {29public:30  FromShort(short s);31};32 33class FromShortExplicitly { // expected-note{{candidate constructor (the implicit copy constructor)}}34#if __cplusplus >= 201103L // C++11 or later35// expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}}36#endif37 38public:39  explicit FromShortExplicitly(short s); // expected-note {{explicit constructor is not a candidate}}40};41 42void explicit_constructor(short s) {43  FromShort fs1(s);44  FromShort fs2 = s;45  FromShortExplicitly fse1(s);46  FromShortExplicitly fse2 = s; // expected-error{{no viable conversion}}47}48 49// PR551950struct X1 { X1(const char&); };51void x1(X1);52void y1() {53  x1(1);54}55