mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 19:03:13 +01:00
Automated merge with http://hg.dsource.org/projects/ldc
This commit is contained in:
@@ -3234,10 +3234,13 @@ int StructLiteralExp::isLvalue()
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Removed in LDC. See declaration.
|
||||
Expression *StructLiteralExp::toLvalue(Scope *sc, Expression *e)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int StructLiteralExp::checkSideEffect(int flag)
|
||||
|
||||
@@ -502,7 +502,9 @@ struct StructLiteralExp : Expression
|
||||
void scanForNestedRef(Scope *sc);
|
||||
Expression *optimize(int result);
|
||||
Expression *interpret(InterState *istate);
|
||||
Expression *toLvalue(Scope *sc, Expression *e);
|
||||
// LDC: struct literals aren't lvalues! Taking their address can lead to
|
||||
// incorrect behavior, see LDC#218, DMD#2682
|
||||
// Expression *toLvalue(Scope *sc, Expression *e);
|
||||
|
||||
int inlineCost(InlineCostState *ics);
|
||||
Expression *doInline(InlineDoState *ids);
|
||||
|
||||
@@ -46,7 +46,7 @@ Expression *fromConstInitializer(Expression *e1)
|
||||
if (e1->op == TOKvar)
|
||||
{ VarExp *ve = (VarExp *)e1;
|
||||
VarDeclaration *v = ve->var->isVarDeclaration();
|
||||
if (v && v->isConst() && v->init && !v->init->isStructInitializer())
|
||||
if (v && v->isConst() && v->init)
|
||||
{ Expression *ei = v->init->toExpression();
|
||||
if (ei && ei->type)
|
||||
e1 = ei;
|
||||
|
||||
Reference in New Issue
Block a user