[cfe-commits] r39568 - /cfe/cfe/trunk/Sema/SemaExpr.cpp

bwendlin at cs.uiuc.edu bwendlin at cs.uiuc.edu
Wed Jul 11 09:45:42 PDT 2007


Author: bwendlin
Date: Wed Jul 11 11:45:42 2007
New Revision: 39568

URL: http://llvm.org/viewvc/llvm-project?rev=39568&view=rev
Log:
Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- If the LHS and/or RHS is a reference, then see if they're compatible.
  If so, the type is that of the LHS.

Modified:
    cfe/cfe/trunk/Sema/SemaExpr.cpp

Modified: cfe/cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaExpr.cpp?rev=39568&r1=39567&r2=39568&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExpr.cpp Wed Jul 11 11:45:42 2007
@@ -699,6 +699,11 @@
   } else if (isa<TagType>(lhsType) && isa<TagType>(rhsType)) {
     if (Type::tagTypesAreCompatible(lhsType, rhsType))
       return rhsType;
+  } else if (lhsType->isReferenceType() || rhsType->isReferenceType()) {
+    if (Type::referenceTypesAreCompatible(lhsType, rhsType))
+      // C++ 5.17p1: ...the type of the assignment exression is that of its left
+      // operand.
+      return lhsType;
   }
   r = Incompatible;
   return QualType();





More information about the cfe-commits mailing list