]> granicus.if.org Git - clang/commitdiff
I just do what the comments tell me to do.
authorJohn McCall <rjmccall@apple.com>
Tue, 12 Oct 2010 02:19:57 +0000 (02:19 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 12 Oct 2010 02:19:57 +0000 (02:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116289 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaCXX/expressions.cpp

index 36b88672b3926e10da74df854730aaf578181ff1..52ab62be020fe7249261564d34dc1b8c52135383 100644 (file)
@@ -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
index b51194acd9c3c582ae30b0b3298c8cd68186c43f..6bf59d1167cecdca37cd4335d8b6aa772c4633e9 100644 (file)
@@ -14,3 +14,10 @@ void f0() {
   register int x;
   f0_1(&x);
 }
+
+template <class T> void bar(T &x) { T::fail(); }
+template <class T> void bar(volatile T &x) {}
+void f1() {
+  volatile int x;
+  bar(x = 5);
+}