From: John McCall Date: Tue, 12 Oct 2010 02:19:57 +0000 (+0000) Subject: I just do what the comments tell me to do. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bf6f49ffa839c966f692420491145adeac4f1e2;p=clang I just do what the comments tell me to do. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116289 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 36b88672b3..52ab62be02 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -6156,7 +6156,8 @@ QualType Sema::CheckAssignmentOperands(Expr *LHS, Expr *&RHS, // is converted to the type of the assignment expression (above). // C++ 5.17p1: the type of the assignment expression is that of its left // operand. - return LHSType.getUnqualifiedType(); + return (getLangOptions().CPlusPlus + ? LHSType : LHSType.getUnqualifiedType()); } // C99 6.5.17 diff --git a/test/SemaCXX/expressions.cpp b/test/SemaCXX/expressions.cpp index b51194acd9..6bf59d1167 100644 --- a/test/SemaCXX/expressions.cpp +++ b/test/SemaCXX/expressions.cpp @@ -14,3 +14,10 @@ void f0() { register int x; f0_1(&x); } + +template void bar(T &x) { T::fail(); } +template void bar(volatile T &x) {} +void f1() { + volatile int x; + bar(x = 5); +}