[llvm] r290700 - Fix mingw build by moving the static const data member before the bitfields
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 28 17:14:41 PST 2016
Author: rnk
Date: Wed Dec 28 19:14:41 2016
New Revision: 290700
URL: http://llvm.org/viewvc/llvm-project?rev=290700&view=rev
Log:
Fix mingw build by moving the static const data member before the bitfields
Apparently GCC targeting Windows breaks bitfields on static data members:
struct Foo {
unsigned X : 16;
static const int M = 42;
unsigned Y : 16;
};
static_assert(sizeof(Foo) == 4, "asdf"); // fails
Who knew.
Modified:
llvm/trunk/include/llvm/IR/GlobalValue.h
Modified: llvm/trunk/include/llvm/IR/GlobalValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/GlobalValue.h?rev=290700&r1=290699&r2=290700&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/GlobalValue.h (original)
+++ llvm/trunk/include/llvm/IR/GlobalValue.h Wed Dec 28 19:14:41 2016
@@ -85,6 +85,9 @@ protected:
}
Type *ValueType;
+
+ static const unsigned GlobalValueSubClassDataBits = 18;
+
// All bitfields use unsigned as the underlying type so that MSVC will pack
// them.
unsigned Linkage : 4; // The linkage of this global
@@ -100,8 +103,6 @@ protected:
/// Function::intrinsicID() returns Intrinsic::not_intrinsic.
unsigned HasLLVMReservedName : 1;
- static const unsigned GlobalValueSubClassDataBits = 18;
-
private:
friend class Constant;
More information about the llvm-commits
mailing list