From: Douglas Gregor Date: Fri, 24 Feb 2012 23:57:42 +0000 (+0000) Subject: Add test for C++ DR899. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b42afdccc9f4b32ed4f83492f87e2cd0518f9f3;p=clang Add test for C++ DR899. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151411 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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); + } +}