aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-03 05:07:04 +0000
committerChris Lattner <sabre@nondot.org>2008-04-03 05:07:04 +0000
commit988ee6ef540d1203cf4aa52971f3c135c796bdf7 (patch)
treea2645915e6d75edd2b65c270271c4af48286549c /lib/AST/ASTContext.cpp
parent4ccea1a2e9ecc0100115b428fbbee546362fb22c (diff)
qualifier comparisons should be done on canonical types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49137 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index d716917b9c..ce75122b3d 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1801,16 +1801,16 @@ bool ASTContext::arrayTypesAreCompatible(QualType lhs, QualType rhs) {
/// C99 6.2.7p1: Two types have compatible types if their types are the
/// same. See 6.7.[2,3,5] for additional rules.
bool ASTContext::typesAreCompatible(QualType lhs, QualType rhs) {
- if (lhs.getCVRQualifiers() != rhs.getCVRQualifiers() ||
- lhs.getAddressSpace() != rhs.getAddressSpace())
- return false;
-
QualType lcanon = lhs.getCanonicalType();
QualType rcanon = rhs.getCanonicalType();
-
+
// If two types are identical, they are are compatible
if (lcanon == rcanon)
return true;
+
+ if (lcanon.getCVRQualifiers() != rcanon.getCVRQualifiers() ||
+ lcanon.getAddressSpace() != rcanon.getAddressSpace())
+ return false;
// C++ [expr]: If an expression initially has the type "reference to T", the
// type is adjusted to "T" prior to any further analysis, the expression