| Anders Carlsson | 7a6e13a | 2010-01-24 17:15:04 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s |
| 2 | namespace Constructor { | ||||
| 3 | struct A { | ||||
| 4 | A(int); | ||||
| 5 | }; | ||||
| 6 | |||||
| 7 | struct B { | ||||
| 8 | explicit B(int); | ||||
| 9 | }; | ||||
| 10 | |||||
| 11 | B::B(int) { } | ||||
| 12 | |||||
| 13 | struct C { | ||||
| 14 | void f(const A&); | ||||
| 15 | void f(const B&); | ||||
| 16 | }; | ||||
| 17 | |||||
| 18 | void f(C c) { | ||||
| 19 | c.f(10); | ||||
| 20 | } | ||||
| 21 | } | ||||
| 22 | |||||
| 23 | namespace Conversion { | ||||
| 24 | struct A { | ||||
| 25 | operator int(); | ||||
| 26 | explicit operator bool(); | ||||
| 27 | }; | ||||
| 28 | |||||
| 29 | A::operator bool() { return false; } | ||||
| 30 | |||||
| 31 | struct B { | ||||
| 32 | void f(int); | ||||
| 33 | void f(bool); | ||||
| 34 | }; | ||||
| 35 | |||||
| 36 | void f(A a, B b) { | ||||
| 37 | b.f(a); | ||||
| 38 | } | ||||
| 39 | } | ||||