From e54d75354cf187f367303888081cdee54f4d4f47 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sun, 14 Jun 2009 12:27:51 +0200 Subject: [PATCH] Cannot take the address of a slice or struct literal as a constant expression. --- gen/toir.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gen/toir.cpp b/gen/toir.cpp index 17d31c27..55f3c88f 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -987,12 +987,12 @@ LLConstant* AddrExp::toConstElem(IRState* p) 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