[cfe-dev] abort calling getTypeSize

Dmitri Gribenko gribozavr at gmail.com
Mon Feb 25 09:35:25 PST 2013

On Mon, Feb 25, 2013 at 7:24 PM, Peeter Joot <peeter.joot at gmail.com> wrote:
> any suggestion how to weaken the isDependentType() checking here to allow
> it's use on the field noInheritance::m_pNext above, but still avoid the
> abort that occurs with OSS_STRUCTURE_PAD_DELTA::pad?


I may be wrong, but I would say that it is by design, and you don't
really want to do what you are doing right now.  There's no practical
sense in examining record layout of a dependent record type.  Sure,
you can get the expected results in that particular case, but what

template<typename T>
struct S {
  T t;
  int i;

Whatever offset of 'i' you will get, it will be wrong, because it
depends on sizeof(T) and record layout rules applied to that.

You might want to examine the layout of an instantiation instead.


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the cfe-dev mailing list