Patch to implement static casting which requires one
user-defined type conversion. Fixes PR5040.
llvm-svn: 83211
diff --git a/clang/test/SemaCXX/cast-conversion.cpp b/clang/test/SemaCXX/cast-conversion.cpp
new file mode 100644
index 0000000..cbc24ae
--- /dev/null
+++ b/clang/test/SemaCXX/cast-conversion.cpp
@@ -0,0 +1,21 @@
+// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+
+struct R {
+ R(int);
+};
+
+struct A {
+ A(R);
+};
+
+struct B {
+ B(A);
+};
+
+int main () {
+ B(10); // expected-error {{functional-style cast from 'int' to 'struct B' is not allowed}}
+ (B)10; // expected-error {{C-style cast from 'int' to 'struct B' is not allowed}}
+ static_cast<B>(10); // expected-error {{static_cast from 'int' to 'struct B' is not allowed}} \\
+ // expected-warning {{expression result unused}}
+}
+