Is the “empty base optimization” in GCC configurable?

后端 未结 3 1235
Happy的楠姐
Happy的楠姐 2021-01-04 23:39

Consider these types:

  struct A {};
  struct B : A { int i; };

sizeof(A) > 0 as required by the standard.

si

3条回答
  •  长发绾君心
    2021-01-04 23:52

    Well, it's not a complete answer, but the GCC Manual mentions that g++ can sometimes place empty base classes at the wrong offset. See the bit about the -Wabi option.

提交回复
热议问题