[cfe-commits] r46158 - in /cfe/trunk: CodeGen/CGExprAgg.cpp test/CodeGen/struct.c

Anders Carlsson andersca at mac.com
Thu Jan 17 18:26:09 PST 2008


Author: andersca
Date: Thu Jan 17 20:25:57 2008
New Revision: 46158

URL: http://llvm.org/viewvc/llvm-project?rev=46158&view=rev
Log:
Assert that the type of the cast is equal to the _unqualified_ type of the subexpression. Fixes a problem spotted by Nuno Lopes.

Modified:
    cfe/trunk/CodeGen/CGExprAgg.cpp
    cfe/trunk/test/CodeGen/struct.c

Modified: cfe/trunk/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprAgg.cpp?rev=46158&r1=46157&r2=46158&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/CodeGen/CGExprAgg.cpp Thu Jan 17 20:25:57 2008
@@ -142,7 +142,7 @@
   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());
 }

Modified: cfe/trunk/test/CodeGen/struct.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct.c?rev=46158&r1=46157&r2=46158&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/struct.c (original)
+++ cfe/trunk/test/CodeGen/struct.c Thu Jan 17 20:25:57 2008
@@ -127,3 +127,12 @@
     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





More information about the cfe-commits mailing list