[cxx-abi-dev] Passing an empty class by value

Nelson, Clark clark.nelson at intel.com
Fri Dec 11 00:11:18 UTC 2015


It has come to my attention that GCC and clang generate incompatible code
for passing an argument of an empty class type.

clang seems to completely ignore arguments and parameters of empty class
type -- which seems to make a certain amount of sense.

OTOH, as far as I understand it, GCC effectively treats an empty class
equivalently to a class containing a single member with some character
type -- which also seems pretty reasonable.

Should the C++ ABI come down on one side or the other of this question?

This is really the sort of question a psABI should settle. But of course
the C language doesn't actually support a structure with no members, so
it's not too surprising if a psABI doesn't nail down what should happen
for this.

--
Clark Nelson            Chair, PL22.16 (ANSI C++ standard committee)
Intel Corporation       Chair, SG10 (C++ SG for feature-testing)
clark.nelson at intel.com  Chair, CPLEX (C SG for parallel language extensions)


More information about the cxx-abi-dev mailing list