Merged DMD commit b9d6cf886404091fd03445c064a17f6332e16f0d:

bugzilla 4866 Static-to-dynamic converted manifest constant array gets non-converted type in static/constraint if
This commit is contained in:
David Nadlinger
2011-04-22 15:05:44 +02:00
parent 5bb5069ec3
commit eb4b2eb402

View File

@@ -1206,20 +1206,31 @@ void VarDeclaration::semantic(Scope *sc)
}
else if (ei)
{
e = e->optimize(WANTvalue | WANTinterpret);
if (e->op == TOKint64 || e->op == TOKstring || e->op == TOKfloat64)
{
ei->exp = e; // no errors, keep result
}
#if DMDV2
if (isDataseg() || (storage_class & STCmanifest))
e = e->optimize(WANTvalue | WANTinterpret);
else
e = e->optimize(WANTvalue);
switch (e->op)
{
/* Save scope for later use, to try again
*/
scope = new Scope(*sc);
scope->setNoFree();
}
case TOKint64:
case TOKfloat64:
case TOKstring:
case TOKarrayliteral:
case TOKassocarrayliteral:
case TOKstructliteral:
case TOKnull:
ei->exp = e; // no errors, keep result
break;
default:
#if DMDV2
/* Save scope for later use, to try again
*/
scope = new Scope(*sc);
scope->setNoFree();
#endif
break;
}
}
else
init = i2; // no errors, keep result