MS(VC++) is weird; our PODness logic is incomplete - so far, only the special case that any constructor makes a struct a non-POD is handled:
|
bool TargetABI::isPOD(Type *t, bool excludeStructsWithCtor) { |
|
t = t->baseElemOf(); |
|
if (t->ty != TY::Tstruct) |
|
return true; |
|
StructDeclaration *sd = static_cast<TypeStruct *>(t)->sym; |
|
return dmd::isPOD(sd) && !(excludeStructsWithCtor && sd->ctor); |
|
} |
Non-public data fields seem to make a struct a non-POD too: #5113 (comment). Not sure if Microsoft had any more great ideas for special cases.
I bet DMD doesn't handle this either. Extending the upstream runnable_cxx/{cppa.d,extra-files/cppb.cpp} tests with the special-struct cases would be good, using a small struct <= 8 bytes which would otherwise be passed/returned in a register.
MS(VC++) is weird; our PODness logic is incomplete - so far, only the special case that any constructor makes a struct a non-POD is handled:
ldc/gen/abi/abi.cpp
Lines 119 to 125 in b996d14
Non-public data fields seem to make a struct a non-POD too: #5113 (comment). Not sure if Microsoft had any more great ideas for special cases.
I bet DMD doesn't handle this either. Extending the upstream
runnable_cxx/{cppa.d,extra-files/cppb.cpp}tests with the special-struct cases would be good, using a small struct <= 8 bytes which would otherwise be passed/returned in a register.