# HG changeset patch # User Christian Kamm # Date 1244975271 -7200 # Node ID d9d50163e1a45162995a37fc3a361766302e4863 # Parent b4fc62f047cdcba423023bff2f843c5ce05547d2 Cannot take the address of a slice or struct literal as a constant expression. diff -r b4fc62f047cd -r d9d50163e1a4 gen/toir.cpp --- 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