changeset 1497:d9d50163e1a4

Cannot take the address of a slice or struct literal as a constant expression.
author Christian Kamm <kamm incasoftware de>
date Sun, 14 Jun 2009 12:27:51 +0200
parents b4fc62f047cd
children 899a928ac905
files gen/toir.cpp
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gen/toir.cpp	Fri Jun 12 21:34:35 2009 +0200
+++ b/gen/toir.cpp	Sun Jun 14 12:27:51 2009 +0200
@@ -987,12 +987,12 @@
         assert(type->toBasetype()->ty == Tpointer);
         return DtoBitCast(gep, DtoType(type));
     }
-    else if (e1->op == TOKstructliteral)
+    else if (
+        e1->op == TOKstructliteral || 
+        e1->op == TOKslice)
     {
-        // FIXME: is this right?
-        StructLiteralExp* slexp = (StructLiteralExp*)e1;
-        LLConstant* lit = slexp->toConstElem(p);
-        return lit;
+        error("non-constant expression '%s'", toChars());
+        fatal();
     }
     // not yet supported
     else