aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaCXXCast.cpp2
-rw-r--r--test/SemaCXX/reinterpret-cast.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp
index c7038322e1..32fd0be375 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -1330,7 +1330,7 @@ void Sema::CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
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/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp
index 449fecb160..68005a5270 100644
--- a/test/SemaCXX/reinterpret-cast.cpp
+++ b/test/SemaCXX/reinterpret-cast.cpp
@@ -119,9 +119,13 @@ namespace PR9564 {
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 dereference_reinterpret_cast() {
(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);