diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-24 23:57:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-24 23:57:42 +0000 |
commit | 9b42afdccc9f4b32ed4f83492f87e2cd0518f9f3 (patch) | |
tree | 597fafa1c18cf1b4726d4a3244644f868aad25cc | |
parent | 3cd89ad193834e766ce5dc24e260aa8615d0d5e1 (diff) |
Add test for C++ DR899.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151411 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp b/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp index 8b8a1efd0e..31a679f1eb 100644 --- a/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp +++ b/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp @@ -13,3 +13,25 @@ namespace ExplicitConv { X x3 = y; // expected-error{{no viable conversion from 'const ExplicitConv::Y' to 'ExplicitConv::X'}} } } + +namespace DR899 { + struct C { }; // expected-note 2 {{candidate constructor}} + + struct A { + explicit operator int() const; + explicit operator C() const; + }; + + struct B { + int i; + B(const A& a): i(a) { } + }; + + int main() { + A a; + int i = a; // expected-error{{no viable conversion}} + int j(a); + C c = a; // expected-error{{no viable conversion}} + C c2(a); + } +} |