]> granicus.if.org Git - clang/commitdiff
Assert that the type of the cast is equal to the _unqualified_ type of the subexpress...
authorAnders Carlsson <andersca@mac.com>
Fri, 18 Jan 2008 02:25:57 +0000 (02:25 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 18 Jan 2008 02:25:57 +0000 (02:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46158 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CGExprAgg.cpp
test/CodeGen/struct.c

index 5836262175fccc8ea27f28471e36a9382a03aca9..3781407f98822ca071532e16c3c7517cec0465af 100644 (file)
@@ -142,7 +142,7 @@ void AggExprEmitter::VisitImplicitCastExpr(ImplicitCastExpr *E)
   QualType STy = E->getSubExpr()->getType().getCanonicalType();
   QualType Ty = E->getType().getCanonicalType();
   
-  assert(STy == Ty && "Implicit cast types must be equal");
+  assert(STy.getUnqualifiedType() == Ty && "Implicit cast types must be equal");
   
   Visit(E->getSubExpr());
 }
index 8f9ecd6080ab9523c234ea658106744f8e8b499a..be5917a3da9af1f54c7389782fa0cbfeeafd266f 100644 (file)
@@ -127,3 +127,12 @@ void f11()
     a1 = a2;
     a2 = a1;
 }
+
+/* Implicit casts (due to const) */
+void f12()
+{
+       struct _a a1;
+       const struct _a a2;
+       
+       a1 = a2;
+}
\ No newline at end of file