title: Static variable inside a template base class
body: <p>This prints nothing:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  template &lt;typename Derived&gt;
  struct A
  {
      static int test()
      {
          std::cout &lt;&lt; "test" &lt;&lt; std::endl;
          return 0;
      }
  
      static inline int a = test();
  };
  
  struct B : public A&lt;B&gt;
  {
  };
  
  int main(int argc, char** argv)
  {
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>But this does:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  template &lt;typename Derived&gt;
  struct A
  {
  };
  
  struct B : public A&lt;B&gt;
  {
      static int test()
      {
          std::cout &lt;&lt; "test" &lt;&lt; std::endl;
          return 0;
      }
  
      static inline int a = test();
  };
  
  int main(int argc, char** argv)
  {
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>And also this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  struct A
  {
      static int test()
      {
          std::cout &lt;&lt; "test" &lt;&lt; std::endl;
          return 0;
      }
  
      static inline int a = test();
  };
  
  struct B : public A
  {
  
  };
  
  int main(int argc, char** argv)
  {
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>Not sure why or a workaround. I need the 'Derived' type to register it into a static table. </p>