title: Why are bit fields not allowed as static data members of a class
body: <p>Can anyone explain the reason behind not allowing bit fields as static member of a class? For example, a class defined like:</p>
  
  <pre><code>class A{
  public:
      A() {}
      ~A(){}
  private:
      static int mem :10;
  };
  int A::mem;
  </code></pre>
  
  <p>doesn't compile.</p>
  
  <p>Compiling this class with different compilers:-</p>
  
  <p>1- g++ throws error:-</p>
  
  <p>error: static member 'mem' cannot be a bit-field</p>
  
  <pre><code>static int mem :10;
  </code></pre>
  
  <p>error: ‘int A::mem’ is not a static data member of ‘class A’</p>
  
  <p>int A::mem;</p>
  
  <p>2- clang throws error:-</p>
  
  <p>error: static member 'mem' cannot be a bit-field</p>
  
  <pre><code>static int mem :10;
  </code></pre>
  
  <p>3-Visual Studio 15 throws error:-</p>
  
  <p>'A::mem'::illegal storage class</p>
  
  <p>'int A::mem':member function redeclaration not allowed</p>