Fix a bug in -Wundefined-reinterpret-cast where we failed to look
through sugared types when testing for TagTypes. This was the actual
cause of the only false positive in Clang+LLVM.

Next evaluation will be over a much larger selection of code including
large amounts of open source code.

llvm-svn: 131957
diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp
index c703832..32fd0be 100644
--- a/clang/lib/Sema/SemaCXXCast.cpp
+++ b/clang/lib/Sema/SemaCXXCast.cpp
@@ -1330,7 +1330,7 @@
     return;
   }
   // or one of the types is a tag type.
-  if (isa<TagType>(SrcTy) || isa<TagType>(DestTy)) {
+  if (SrcTy->getAs<TagType>() || DestTy->getAs<TagType>()) {
     return;
   }
 
diff --git a/clang/test/SemaCXX/reinterpret-cast.cpp b/clang/test/SemaCXX/reinterpret-cast.cpp
index 449fecb..68005a5 100644
--- a/clang/test/SemaCXX/reinterpret-cast.cpp
+++ b/clang/test/SemaCXX/reinterpret-cast.cpp
@@ -119,9 +119,13 @@
 
 void dereference_reinterpret_cast() {
   struct A {};
+  typedef A A2;
   class B {};
+  typedef B B2;
   A a;
   B b;
+  A2 a2;
+  B2 b2;
   long l;
   double d;
   float f;
@@ -142,6 +146,10 @@
   (void)*reinterpret_cast<A*>(&b);
   (void)reinterpret_cast<B&>(a);
   (void)*reinterpret_cast<B*>(&a);
+  (void)reinterpret_cast<A2&>(b2);
+  (void)*reinterpret_cast<A2*>(&b2);
+  (void)reinterpret_cast<B2&>(a2);
+  (void)*reinterpret_cast<B2*>(&a2);
 
   // Casting to itself is allowed
   (void)reinterpret_cast<A&>(a);