]> granicus.if.org Git - clang/commitdiff
Fix comment typo, do reference eval at the correct type.
authorChris Lattner <sabre@nondot.org>
Mon, 7 Apr 2008 05:37:56 +0000 (05:37 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 7 Apr 2008 05:37:56 +0000 (05:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49315 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp

index 31537947a0da164a99b77edea1ff891376dd0f0d..bd914fd98406d647505cdfe9fbbb9fd845c357ca 100644 (file)
@@ -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();