Reapply r349876:

Apply a workaround to be able to build clang 8.0.0 headers with clang
3.4.1, which is still in the stable/10 branch.

It looks like clang 3.4.1 implements static_asserts by instantiating a
temporary static object, and if those are in an anonymous union, it
results in "error: anonymous union can only contain non-static data
members".

To work around this implementation limitation, move the static_asserts
in question out of the anonymous unions.

This should make building the latest stable/11 from stable/10 possible
again.

Reported by:	Mike Tancsa <mike@sentex.net>
This commit is contained in:
Dimitry Andric 2020-08-06 16:42:48 +00:00
parent 4beee10792
commit ebc1d79aff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang1100-import/; revision=363970
2 changed files with 57 additions and 57 deletions

View File

@ -1760,6 +1760,7 @@ class DeclContext {
ObjCContainerDeclBitfields ObjCContainerDeclBits;
LinkageSpecDeclBitfields LinkageSpecDeclBits;
BlockDeclBitfields BlockDeclBits;
};
static_assert(sizeof(DeclContextBitfields) <= 8,
"DeclContextBitfields is larger than 8 bytes!");
@ -1783,7 +1784,6 @@ class DeclContext {
"LinkageSpecDeclBitfields is larger than 8 bytes!");
static_assert(sizeof(BlockDeclBitfields) <= 8,
"BlockDeclBitfields is larger than 8 bytes!");
};
/// FirstDecl - The first declaration stored within this declaration
/// context.

View File

@ -1803,6 +1803,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
DependentTemplateSpecializationTypeBitfields
DependentTemplateSpecializationTypeBits;
PackExpansionTypeBitfields PackExpansionTypeBits;
};
static_assert(sizeof(TypeBitfields) <= 8,
"TypeBitfields is larger than 8 bytes!");
@ -1837,7 +1838,6 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
" than 8 bytes!");
static_assert(sizeof(PackExpansionTypeBitfields) <= 8,
"PackExpansionTypeBitfields is larger than 8 bytes");
};
private:
template <class T> friend class TypePropertyCache;