[PATCH] D45174: non-zero-length bit-fields should make a class non-empty

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 12:04:16 PDT 2018


rsmith created this revision.
rsmith added a reviewer: rjmccall.
Herald added a subscriber: sanjoy.

This implements the rule intended by the standard (see LWG 2358) and the rule presumably intended by the Itanium C++ ABI (see https://github.com/itanium-cxx-abi/cxx-abi/pull/51), and makes Clang match the behavior of GCC, ICC, and MSVC. A pedantic reading of both the standard and the ABI indicate that Clang is currently technically correct, but that's not worth much when it's clear that the wording is wrong in both those places.

This is an ABI break for classes that derive from a class that is empty other than one or more unnamed non-zero-length bit-fields. Such cases are expected to be rare, but -fclang-abi-compat=6 restores the old behavior just in case.


Repository:
  rC Clang

https://reviews.llvm.org/D45174

Files:
  AST/DeclCXX.cpp
  Layout/ms-x86-pack-and-align.cpp
  Layout/v6-empty.cpp
  ReleaseNotes.rst
  SemaCXX/type-traits.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45174.140654.patch
Type: text/x-patch
Size: 8507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180402/03276315/attachment.bin>


More information about the cfe-commits mailing list