[Issue 4322] "void initializer has no value" on struct/union members initialized to "void"
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 16 12:31:13 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4322
--- Comment #5 from Graham Fawcett <graham.fawcett at gmail.com> 2010-06-16 12:31:07 PDT ---
(In reply to comment #3)
> That's too general, the error message is important in other places. I think the
> correct fix for the bug, is to allow a void initializer to be used inside
> another initializer. This might be a bug in the array literal initializers in
> mtype.c, which (from memory) creates an array literal by converting the
> initializers to expressions. At least in the case where ALL initializers are
> void, the final initializer could also be void.
> So the test case should be transformed into:
> Foo f = void;
> But the simplest solution is probably to change all members into default
> initializers, if they are a VoidInitializers.
> I recommend to put a breakpoint on the error message and find out where it's
> being called from.
Don, you're right. My test case above did not fail through mtype.c,
but rather through expression.c (and I've proposed a patch for that).
But I was able to produce a similar bug through mtype.c:
import std.stdio;
import std.variant;
import std.algorithm;
void main() {
foreach (int v; map! "a.get!int" (variantArray(1,2,3)))
writeln(v);
}
which fails here:
#0 VoidInitializer::toExpression (this=0x9139748) at init.c:100
#1 0x0810047b in TypeStruct::defaultInitLiteral (this=0x8d98ff0, loc=...)
at mtype.c:6921
#2 0x081039b5 in Type::getProperty (this=0x8d98ff0, loc=..., ident=0x81aec50)
at mtype.c:1691
#3 0x08102944 in Type::dotExp (this=0x8d98ff0, sc=0x9177c50, e=0x9320c88,
ident=0x81aec50) at mtype.c:1809
etc.
I'll take a look into mtype.c as well.
--
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