From db4f06ed2c1128f65d2af763557d1cba45c46665 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 2 Jun 2007 23:29:59 +0000 Subject: [PATCH] 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. llvm-svn: 39568 --- clang/Sema/SemaExpr.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp index 8e852fbd2aff..64574a7db55f 100644 --- a/clang/Sema/SemaExpr.cpp +++ b/clang/Sema/SemaExpr.cpp @@ -699,6 +699,11 @@ QualType Sema::UsualAssignmentConversions(QualType lhsType, QualType rhsType, } else if (isa(lhsType) && isa(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();