1ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao// RUN: %clang_cc1 -fsyntax-only -verify %s
2ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaoclass Z { };
3ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
4ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaoclass Y {
5ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaopublic:
6ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  Y(const Z&);
7ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao};
8ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
9ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaoclass X {
10ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaopublic:
11ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  X(int);
12ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  X(const Y&);
13ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao};
14ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
15ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaovoid f(X); // expected-note{{candidate function}}
16ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
17ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaovoid g(short s, Y y, Z z) {
18ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  f(s);
19ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  f(1.0f);
20ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  f(y);
21ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  f(z); // expected-error{{no matching function}}
22ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao}
23ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
24ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
25ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaoclass FromShort {
26ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaopublic:
27ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  FromShort(short s);
28ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao};
29ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
30ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaoclass FromShortExplicitly { // expected-note{{candidate constructor (the implicit copy constructor)}}
31ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaopublic:
32ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  explicit FromShortExplicitly(short s);
33ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao};
34ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
35ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaovoid explicit_constructor(short s) {
36ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  FromShort fs1(s);
37ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  FromShort fs2 = s;
38ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  FromShortExplicitly fse1(s);
39ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  FromShortExplicitly fse2 = s; // expected-error{{no viable conversion}}
40ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao}
41ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao
42ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao// PR5519
43ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaostruct X1 { X1(const char&); };
44ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaovoid x1(X1);
45ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liaovoid y1() {
46ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao  x1(1);
47ea285162342df160e7860e26528bc7110bc6c0cdShih-wei Liao}
48