"ubyte[size] store = void" in std.variant
Graham Fawcett
fawcett at uwindsor.ca
Tue Jun 15 06:04:23 PDT 2010
Hi folks,
The following statement appears in std.variant:
190 union
191 {
192 ubyte[size] store = void;
193 // conservatively mark the region as pointers
194 static if (size >= (void*).sizeof)
195 void* p[size / (void*).sizeof];
196 }
The '= void' on line 192 sometimes leads to 'Error: void initializer
has no value' errors in application code. For example, this fails to
compile on DMD 2.047:
foreach (int v; map! "a.get!int" (variantArray(1,2,3)))
writeln(v);
Changing line 192 to 'ubyte[size] store;' resolves the issue.
My question is: what is the point of the '= void' initializer here?
Would std.variant be broken if '= void' were removed?
Thanks,
Graham
More information about the Digitalmars-d
mailing list