Index: lib/Sema/SemaCast.cpp
===================================================================
--- lib/Sema/SemaCast.cpp	(revision 148260)
+++ lib/Sema/SemaCast.cpp	(working copy)
@@ -1619,7 +1619,34 @@
     
     return TC_Failed;
   }
-  
+
+  if (SrcType == DestType) {
+    // C++ 5.2.10p2 has a note that mentions that, subject to all other
+    // restrictions, a cast to the same type is allowed so long as it does not
+    // cast away constness. The intent is not entirely clear here, since all 
+    // other paragraphs explicitly forbid casts to the same type.
+    //
+    // The only allowed types are: integral, enumeration, pointer, or 
+    // pointer-to-member types.
+    Kind = CK_NoOp;
+    TryCastResult Result = TC_NotApplicable;
+    if (SrcType->isIntegralOrEnumerationType()) {
+      Result = TC_Success;
+    } else if (SrcType->isPointerType() ||
+      SrcType->isMemberPointerType()) {
+      // If the source is a pointer type, then we need to ensure that we do
+      // not cast away constness.
+      if (CastsAwayConstness(Self, SrcType, DestType, /*CheckCVR=*/!CStyle,
+                           /*CheckObjCLifetime=*/CStyle)) {
+        msg = diag::err_bad_cxx_cast_qualifiers_away;
+        Result = TC_Failed;
+      } else {
+        Result = TC_Success;
+      }
+    }
+    return Result;
+  }
+
   bool destIsPtr = DestType->isAnyPointerType() ||
                    DestType->isBlockPointerType();
   bool srcIsPtr = SrcType->isAnyPointerType() ||
@@ -1630,17 +1657,6 @@
     return TC_NotApplicable;
   }
 
-  if (SrcType == DestType) {
-    // C++ 5.2.10p2 has a note that mentions that, subject to all other
-    // restrictions, a cast to the same type is allowed. The intent is not
-    // entirely clear here, since all other paragraphs explicitly forbid casts
-    // to the same type. However, the behavior of compilers is pretty consistent
-    // on this point: allow same-type conversion if the involved types are
-    // pointers, disallow otherwise.
-    Kind = CK_NoOp;
-    return TC_Success;
-  }
-
   if (DestType->isIntegralType(Self.Context)) {
     assert(srcIsPtr && "One type must be a pointer");
     // C++ 5.2.10p4: A pointer can be explicitly converted to any integral
Index: test/SemaCXX/reinterpret-cast.cpp
===================================================================
--- test/SemaCXX/reinterpret-cast.cpp	(revision 148260)
+++ test/SemaCXX/reinterpret-cast.cpp	(working copy)
@@ -9,13 +9,27 @@
 // Test the conversion to self.
 void self_conversion()
 {
-  // T*->T* is allowed, T->T in general not.
+  // T->T is allowed per [expr.reinterpret.cast]p2 so long as it doesn't
+  // cast away constness, and is integral, enumeration, pointer or 
+  // pointer-to-member.
   int i = 0;
-  (void)reinterpret_cast<int>(i); // expected-error {{reinterpret_cast from 'int' to 'int' is not allowed}}
+  (void)reinterpret_cast<int>(i);
+
+  test e = testval;
+  (void)reinterpret_cast<test>(e);
+
+  // T*->T* is allowed
+  int *pi = 0;
+  (void)reinterpret_cast<int*>(pi);
+
+  const int structure::*psi = 0;
+  (void)reinterpret_cast<const int structure::*>(psi);
+
   structure s;
   (void)reinterpret_cast<structure>(s); // expected-error {{reinterpret_cast from 'structure' to 'structure' is not allowed}}
-  int *pi = 0;
-  (void)reinterpret_cast<int*>(pi);
+
+  float f = 0.0f;
+  (void)reinterpret_cast<float>(f); // expected-error {{reinterpret_cast from 'float' to 'float' is not allowed}}
 }
 
 // Test conversion between pointer and integral types, as in /3 and /4.
