[Issue 3809] Struct initializers apparently always CTFE'd, and incorrectly
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 23 12:58:22 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3809
--- Comment #3 from Don <clugdbug at yahoo.com.au> 2010-04-23 12:58:21 PDT ---
(In reply to comment #2)
> Starting with the simple thing: the missing line number in the division by 0
> error message.
> PATCH: interpret.c, near the start of BinExp::interpretAssignCommon().
[snip]
Oops, that patch fixed a related test case:
struct S { int xx; }
int badline() { S s; return 100/s.xx; }
static assert(badline());
To fix this one as well, the same patch needs to applied to interpret.c,
getVarExp(), around line 1250.
if (v->init)
{
if (v->init->isVoidInitializer())
{
error(loc, "variable %s is used before initialization",
v->toChars());
return EXP_CANT_INTERPRET;
}
e = v->init->toExpression();
e = e->interpret(istate);
}
else // This should never happen
{
- e = v->type->defaultInitLiteral();
+ e = v->type->defaultInitLiteral(loc);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list