title: "Invalid use of non-static data member" when initializing static member from global variable
body: <pre><code>class A {
      int x;
      static int i;
  };
  
  
  int x = 10;
  int A::i = x;
  </code></pre>
  <p>When I compile the code above, it get the error</p>
  <pre><code>&lt;source&gt;:8:12: error: invalid use of non-static data member 'A::x'
      8 | int A::i = x;
        |            ^
  &lt;source&gt;:2:9: note: declared here
      2 |     int x;
        |         ^
  </code></pre>
  <p>What's causing this error?</p>