Member function increases size of a struct defined in a function - is this a bug?

Max Samukha maxsamukha at gmail.com
Tue Feb 11 14:05:38 UTC 2020


On Tuesday, 11 February 2020 at 13:04:01 UTC, Dennis wrote:

>
> But the takeaway is: even if you make a decision a bit more 
> intelligently, it can increase compiler complexity in 
> unexpected ways.

Yes, I am aware of the problem:

struct S {
     int a;

     // has the same problem as sizeof but compiles
     static if (__traits(allMembers, S).length == 1) {
         int b;
     }
}

Don't know what would I do about it.



More information about the Digitalmars-d mailing list