[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 06:39:22 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4322
--- Comment #4 from Graham Fawcett <graham.fawcett at gmail.com> 2010-06-16 06:39:19 PDT ---
Created an attachment (id=664)
proposed patch
When initializing an array, this patch tests whether the initializer
is a VoidInitializer, and if so, avoids the toExpression() call. This
permits arrays to be initialized "= void".
This compiles and appears to work as expected:
void main() {
struct foo {
union {
char[100] c = void;
ubyte[100] b
}
ubyte[5] good = 44;
ubyte[5] bad = void;
}
foo f = foo();
writeln("b ", f.b);
writeln("c ", f.c);
writeln("good ", f.good);
writeln("bad ", f.bad);
}
"good" displays as '44 44 44 44 44', but the void attributes appear
uninitialized.
This still fails to compile (as it should):
void main() {
void[1] a;
}
--
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