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!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88848 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp
index 68f1dff..d396272 100644
--- a/test/SemaCXX/static-cast.cpp
+++ b/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 @@
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;
+};