diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-07 05:37:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-07 05:37:56 +0000 |
commit | f3692dc4a47dc48d10cec0415c6e9e39b7a39707 (patch) | |
tree | 0c652af7016d4752c4548aa3e5933831a8235c7e /lib/AST/ASTContext.cpp | |
parent | f62f9cd5a78e5445a02e37b277f7a2df9c19b7a3 (diff) |
Fix comment typo, do reference eval at the correct type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49315 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 31537947a0..bd914fd984 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1628,14 +1628,6 @@ bool ASTContext::typesAreCompatible(QualType LHS_NC, QualType RHS_NC) { QualType LHS = LHS_NC.getCanonicalType(); QualType RHS = RHS_NC.getCanonicalType(); - // If two types are identical, they are are compatible - if (LHS == RHS) - return true; - - if (LHS.getCVRQualifiers() != RHS.getCVRQualifiers() || - LHS.getAddressSpace() != RHS.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 // designates the object or function denoted by the reference, and the @@ -1645,6 +1637,15 @@ bool ASTContext::typesAreCompatible(QualType LHS_NC, QualType RHS_NC) { if (ReferenceType *RT = dyn_cast<ReferenceType>(RHS)) RHS = RT->getPointeeType(); + // If two types are identical, they are compatible. + if (LHS == RHS) + return true; + + // If qualifiers differ, the types are different. + if (LHS.getCVRQualifiers() != RHS.getCVRQualifiers() || + LHS.getAddressSpace() != RHS.getAddressSpace()) + return false; + Type::TypeClass LHSClass = LHS->getTypeClass(); Type::TypeClass RHSClass = RHS->getTypeClass(); |