p4-0x.cpp revision 3f83d0de1d14f73c4c9acad76990385905e4b660
1// RUN: %clang_cc1 -std=c++11 -verify -fsyntax-only %s
2
3struct S {
4  constexpr S(bool b) : b(b) {}
5  constexpr explicit operator bool() { return b; }
6  bool b;
7};
8struct T {
9  constexpr operator int() { return 1; }
10};
11struct U {
12  constexpr operator int() { return 1; } // expected-note {{candidate}}
13  constexpr operator long() { return 0; } // expected-note {{candidate}}
14};
15
16static_assert(S(true), "");
17static_assert(S(false), "not so fast"); // expected-error {{not so fast}}
18static_assert(T(), "");
19static_assert(U(), ""); // expected-error {{ambiguous}}
20