rjmccall wrote: > > C++ does have some restrictions on accessing objects that are being > > initialized through other names. It's possible that they're strong enough > > to satisfy the ABI rule here through a sort of reverse of the normal > > analysis: basically, any program that would violate the ABI rule is > > actually incorrect because of the semantic restriction. If not, I think we > > may need to force copies of trivial return types in the caller in C++. We > > can consider that separately, though. > > I suspect it isn't legal to actually access the object through another > pointer while it's being constructed, but that doesn't help if the user is > just doing a pointer equality comparison.
Ah, good point. > And C++17 rules forbid a copy on the caller side: "guaranteed copy elision" > means semantically, there is no copy. An extra copy is permitted for trivially-copyable types; otherwise we'd be required to pass and return all classes indirectly. https://github.com/llvm/llvm-project/pull/101038 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits