]> granicus.if.org Git - llvm/commitdiff
Fix mingw build by moving the static const data member before the bitfields
authorReid Kleckner <rnk@google.com>
Thu, 29 Dec 2016 01:14:41 +0000 (01:14 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 29 Dec 2016 01:14:41 +0000 (01:14 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290700 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/GlobalValue.h

index 403d1a7a61a6a87d64c2ca85afbcf700203b7b4d..c6398aaa4847f8ca2d96873cd4b1dff3c90b6d3c 100644 (file)
@@ -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;