"ubyte[size] store = void" in std.variant

Graham Fawcett fawcett at uwindsor.ca
Tue Jun 15 13:14:34 PDT 2010


On Tue, 15 Jun 2010 17:39:50 +0000, Graham Fawcett wrote:

> On Tue, 15 Jun 2010 13:24:07 -0400, bearophile wrote:
> 
>> Graham Fawcett:
>>>   struct foo {
>>>     enum N = 10; // or whatever
>>>     ubyte[N] store = void;
>>>   }
>>>   foo z = foo();
>> 
>> I think there's a bug there, you can add it to Bugzilla (if not already
>> present):
>> 
>> struct Foo {
>>     int[1] a = void;
>> }
>> void main() {
>>     Foo f = Foo();
>> }
>> 
>> Bye,
>> bearophile
> 
> OK, added.
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=4322
> 
> "void initializer has no value" on struct/union members initialized to
> "void"
> 
> Thanks,
> Graham

FWIW, removing line 100 in init.c allows our simple examples to
compile and run correctly. Of course I'm not 100% clear on why the
error message was there in the first place. :)

diff --git a/trunk/src/init.c b/trunk/src/init.c
index ed3a091..cf9bc72 100644
--- a/trunk/src/init.c
+++ b/trunk/src/init.c
@@ -97,7 +97,6 @@ Initializer *VoidInitializer::semantic(Scope *sc, Type 
*t)
 
 Expression *VoidInitializer::toExpression()
 {
-    error(loc, "void initializer has no value");
     return new IntegerExp(0);
 }

best,
Graham


More information about the Digitalmars-d mailing list