1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify
2 
3 namespace ExplicitConv {
4   struct X { }; // expected-note 2{{candidate constructor}}
5 
6   struct Y {
7     explicit operator X() const; // expected-note {{not a candidate}}
8   };
9 
test(const Y & y)10   void test(const Y& y) {
11     X x(static_cast<X>(y));
12     X x2((X)y);
13     X x3 = y; // expected-error{{no viable conversion from 'const ExplicitConv::Y' to 'ExplicitConv::X'}}
14   }
15 }
16 
17 namespace DR899 {
18   struct C { }; // expected-note 2 {{candidate constructor}}
19 
20   struct A {
21     explicit operator int() const; // expected-note {{not a candidate}}
22     explicit operator C() const; // expected-note {{not a candidate}}
23   };
24 
25   struct B {
26     int i;
BDR899::B27     B(const A& a): i(a) { }
28   };
29 
main()30   int main() {
31     A a;
32     int i = a; // expected-error{{no viable conversion}}
33     int j(a);
34     C c = a; // expected-error{{no viable conversion}}
35     C c2(a);
36   }
37 }
38