[cfe-dev] Wrong size of empty struct in MS mode.

r4start r4start at gmail.com
Fri Nov 18 05:11:52 PST 2011


Hi all!

I found that in MS mode following struct
struct A
{
};
will have null size.
But if I compile with Itanium ABI this struct will have size = 1.

Is that normal?
If it is not then problem is in this condition
if (!isMicrosoftCXXABI() || RD->getNumVBases())
     FinishLayout(RD);

from Layout method in RecordLayoutBuilder.cpp (line 1404).
I suggest to rewrite this condition on something like this
if (!isMicrosoftCXXABI())
     FinishLayout(RD);
else if (!RD->getNumVBases())
     FinishLayout(RD);

  - Dmitry.



More information about the cfe-dev mailing list