rsmith added a comment. In https://reviews.llvm.org/D46218#1082834, @probinson wrote:
> In https://reviews.llvm.org/D46218#1081933, @rjmccall wrote: > > > I wonder if that was originally just an oversight that got turned into > > official policy. Anyway, if it's the policy, it's what we have to do; LGTM. > > > I think it's actually correct behavior. Why would an attribute on a derived > class be allowed to alter the layout of a base class? It would mean you > can't convert Derived* to Base* safely. With Clang's old behavior, base classes were treated exactly like fields -- their layout was not changed per se, but their minimum alignment was reduced. Yes, that means you can't convert `Derived*` to `Base*` safely, but the packed attribute means you can't use `&object.member` to convert `Class*` to `Member*` safely either, so that's not an entirely unique problem. Probably more serious is that GCC doesn't permit a `T&` to bind to a packed field, so treating base classes as packed would interfere with passing a `Derived` lvalue to a `Base&`, which does seem like a much more severe restriction for base classes than for fields. Repository: rL LLVM https://reviews.llvm.org/D46218 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits