diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-11-15 09:20:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-11-15 09:20:52 +0000 |
commit | ab15d0e5af616c11b6cbb478c81d0a8eaa9d450a (patch) | |
tree | 6b0df8ec5feaff61900e216906516e88f7cdef18 /test/SemaCXX/static-cast.cpp | |
parent | c07a494b376f75f33759cf09ad188b11ef3fa9d5 (diff) |
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
Diffstat (limited to 'test/SemaCXX/static-cast.cpp')
-rw-r--r-- | test/SemaCXX/static-cast.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp index 68f1dff276..d3962727b8 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 @@ 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; +}; |