When type-checking a static cast (or the static_cast part of a C-style
cast) that is converting to a class type, enumerate its constructors
as in any other direct initialization. This ensures that we get the
proper conversion sequence.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88751 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp
index d816c05..5d4f1bf 100644
--- a/test/SemaCXX/static-cast.cpp
+++ b/test/SemaCXX/static-cast.cpp
@@ -144,3 +144,21 @@
};
outer<int> EntryList;
}
+
+
+// Initialization by constructor
+struct X0;
+
+struct X1 {
+ X1();
+ X1(X1&);
+ X1(const X0&);
+
+ operator X0() const;
+};
+
+struct X0 { };
+
+void test_ctor_init() {
+ (void)static_cast<X1>(X1());
+}