mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-19 13:13:16 +01:00
Cannot take the address of a slice or struct literal as a constant expression.
This commit is contained in:
10
gen/toir.cpp
10
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
|
||||
|
||||
Reference in New Issue
Block a user