[cfe-commits] r120384 - in /cfe/trunk: lib/Sema/SemaCXXCast.cpp test/SemaTemplate/dependent-expr.cpp

John McCall rjmccall at apple.com
Mon Nov 29 18:05:44 PST 2010


Author: rjmccall
Date: Mon Nov 29 20:05:44 2010
New Revision: 120384

URL: http://llvm.org/viewvc/llvm-project?rev=120384&view=rev
Log:
Fix another case of giving the wrong value kind to a dependent cast to
a non-dependent type.


Modified:
    cfe/trunk/lib/Sema/SemaCXXCast.cpp
    cfe/trunk/test/SemaTemplate/dependent-expr.cpp

Modified: cfe/trunk/lib/Sema/SemaCXXCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXCast.cpp?rev=120384&r1=120383&r2=120384&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Mon Nov 29 20:05:44 2010
@@ -1375,13 +1375,16 @@
     return false;
   }
 
+  // Make sure we determine the value kind before we bail out for
+  // dependent types.
+  VK = Expr::getValueKindForType(CastTy);
+
   // If the type is dependent, we won't do any other semantic analysis now.
   if (CastTy->isDependentType() || CastExpr->isTypeDependent()) {
     Kind = CK_Dependent;
     return false;
   }
 
-  VK = Expr::getValueKindForType(CastTy);
   if (VK == VK_RValue && !CastTy->isRecordType())
     DefaultFunctionArrayLvalueConversion(CastExpr);
 

Modified: cfe/trunk/test/SemaTemplate/dependent-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-expr.cpp?rev=120384&r1=120383&r2=120384&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-expr.cpp (original)
+++ cfe/trunk/test/SemaTemplate/dependent-expr.cpp Mon Nov 29 20:05:44 2010
@@ -52,3 +52,12 @@
              &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
   }
 }
+
+namespace test5 {
+  template <typename T> class chained_map {
+    int k;
+    void lookup() const {
+      int &v = (int &)k;
+    }
+  };
+}





More information about the cfe-commits mailing list