summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/static-cast.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-14 03:27:21 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-14 03:27:21 +0000
commitbf3f322034bdf663665675629c887df00556c726 (patch)
tree283b84e3ad4ae54f9dff5c0b3f9f9a3894bde02c /clang/test/SemaCXX/static-cast.cpp
parent50ec0da0e1dc16dcd720719892efdf912bbdd32e (diff)
downloadbcm5719-llvm-bf3f322034bdf663665675629c887df00556c726.tar.gz
bcm5719-llvm-bf3f322034bdf663665675629c887df00556c726.zip
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. llvm-svn: 88751
Diffstat (limited to 'clang/test/SemaCXX/static-cast.cpp')
-rw-r--r--clang/test/SemaCXX/static-cast.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/static-cast.cpp b/clang/test/SemaCXX/static-cast.cpp
index d816c05e3ee..5d4f1bfcdf0 100644
--- a/clang/test/SemaCXX/static-cast.cpp
+++ b/clang/test/SemaCXX/static-cast.cpp
@@ -144,3 +144,21 @@ namespace pr5261 {
};
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());
+}
OpenPOWER on IntegriCloud