aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCXXCast.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-06-04 22:47:55 +0000
committerAnders Carlsson <andersca@mac.com>2010-06-04 22:47:55 +0000
commit52647c63c3cbdf0c87fe8db3ef6f475bfd49725d (patch)
tree827cd8be9dfe81620e7fc1d3f7c722d308323d67 /lib/Sema/SemaCXXCast.cpp
parentfc929208193eff37e1d3a28b1ea3bd1c9a7913e0 (diff)
When deciding whether reinterpret_cast casts away constness we need to look at array qualifiers. Fixes rdar://problem/8018292.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXCast.cpp')
-rw-r--r--lib/Sema/SemaCXXCast.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp
index 9b95552554..5485bb3e17 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -257,8 +257,13 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType) {
// Find the qualifications.
while (UnwrapDissimilarPointerTypes(UnwrappedSrcType, UnwrappedDestType)) {
- cv1.push_back(UnwrappedSrcType.getQualifiers());
- cv2.push_back(UnwrappedDestType.getQualifiers());
+ Qualifiers SrcQuals;
+ Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals);
+ cv1.push_back(SrcQuals);
+
+ Qualifiers DestQuals;
+ Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals);
+ cv2.push_back(DestQuals);
}
assert(cv1.size() > 0 && "Must have at least one pointer level.");