[cfe-commits] r151411 - /cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp

Douglas Gregor dgregor at apple.com
Fri Feb 24 15:57:42 PST 2012


Author: dgregor
Date: Fri Feb 24 17:57:42 2012
New Revision: 151411

URL: http://llvm.org/viewvc/llvm-project?rev=151411&view=rev
Log:
Add test for C++ DR899.

Modified:
    cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp

Modified: cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp?rev=151411&r1=151410&r2=151411&view=diff
==============================================================================
--- cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp (original)
+++ cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.copy/p1.cpp Fri Feb 24 17:57:42 2012
@@ -13,3 +13,25 @@
     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);
+  }
+}





More information about the cfe-commits mailing list