]> granicus.if.org Git - clang/commitdiff
Add test for C++ DR899.
authorDouglas Gregor <dgregor@apple.com>
Fri, 24 Feb 2012 23:57:42 +0000 (23:57 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 24 Feb 2012 23:57:42 +0000 (23:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151411 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp

index 8b8a1efd0e0be270483843030e1f255101a4ccac..31a679f1ebc0b8a8fe5d5d93d113c6c103feba06 100644 (file)
@@ -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);
+  }
+}