summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/static-cast.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-15 09:20:52 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-15 09:20:52 +0000
commit8f3952cda967f8f9101d245f9056cd184db184bb (patch)
tree3251171c84db0cb54f5b589f634571e04a40a1a9 /clang/test/SemaCXX/static-cast.cpp
parent598caeee376ad4ff58d4e77e03782b9d084df748 (diff)
downloadbcm5719-llvm-8f3952cda967f8f9101d245f9056cd184db184bb.tar.gz
bcm5719-llvm-8f3952cda967f8f9101d245f9056cd184db184bb.zip
When performing a static downcast as part of a static_cast, make sure
that we're dealing with canonical types like the documentation say (yay, CanQualType). Alas, this is another instance where using getQualifiers() on a non-canonical QualType got us in trouble. Good news: with this fix, Clang can now parse all of its own headers! llvm-svn: 88848
Diffstat (limited to 'clang/test/SemaCXX/static-cast.cpp')
-rw-r--r--clang/test/SemaCXX/static-cast.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/static-cast.cpp b/clang/test/SemaCXX/static-cast.cpp
index 68f1dff276b..d3962727b80 100644
--- a/clang/test/SemaCXX/static-cast.cpp
+++ b/clang/test/SemaCXX/static-cast.cpp
@@ -1,5 +1,4 @@
// RUN: clang-cc -fsyntax-only -verify -faccess-control %s
-
struct A {};
struct B : public A {}; // Single public base.
struct C1 : public virtual B {}; // Single virtual base.
@@ -162,3 +161,20 @@ struct X0 { };
void test_ctor_init() {
(void)static_cast<X1>(X1());
}
+
+// Casting away constness
+struct X2 {
+};
+
+struct X3 : X2 {
+};
+
+struct X4 {
+ typedef const X3 X3_typedef;
+
+ void f() const {
+ (void)static_cast<X3_typedef*>(x2);
+ }
+
+ const X2 *x2;
+};
OpenPOWER on IntegriCloud