Possible @property compromise

TommiT tommitissari at hotmail.com
Sat Feb 2 10:47:36 PST 2013


On Saturday, 2 February 2013 at 17:56:41 UTC, Zach the Mystic 
wrote:
> On Saturday, 2 February 2013 at 06:19:29 UTC, TommiT wrote:
>> On Saturday, 2 February 2013 at 03:50:49 UTC, Zach the Mystic 
>> wrote:
>>> [..]
>>
>> What do you suppose would happen if I wrote the following?
>>
>> struct A
>> {
>>  struct B {}
>>
>>  B b1;
>>  B b2;
>> }
>>
>> void main()
>> {
>>  A a;
>>  assert(&a.b1 == &a.b2);
>> }
>
> With my new rules? It would be illegal to take the address of a 
> struct which contained no data.

Yes, that is kind of what I was getting at with my question. But 
I'm going to ask the same thing in a better way now:

Given your new nested struct variable behaviour and my definition 
of struct 'A' quoted above, would the following lines compile?

static assert( A.B.sizeof == 0 );
static assert( A.sizeof == 0 );


More information about the Digitalmars-d mailing list