diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-04-03 05:07:04 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-04-03 05:07:04 +0000 |
| commit | efdc7685d4b28e1a94d7b8dc39f1da5d361b99c8 (patch) | |
| tree | 02e1b72e1fa107e6daeba8e5b42f6b62fda2d996 /clang/lib/AST/ASTContext.cpp | |
| parent | 03e662d5be90cb2dfe4eb158719270ae81163cc7 (diff) | |
| download | bcm5719-llvm-efdc7685d4b28e1a94d7b8dc39f1da5d361b99c8.tar.gz bcm5719-llvm-efdc7685d4b28e1a94d7b8dc39f1da5d361b99c8.zip | |
qualifier comparisons should be done on canonical types.
llvm-svn: 49137
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index d716917b9ce..ce75122b3d7 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/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 |

