title: Defining a static data member of a templated class within a templated class
body: <p>I have a class template inside of another class template. The inner class has a static data member. I am struggling to provide a definition for it. The below example works in clang 3.8 but not in gcc-7.1</p>
  
  <pre><code>template &lt;typename T&gt;
  struct Out {
    template &lt;typename U&gt;
    struct In {
      static int var;
    };
  };
  
  template &lt;typename T&gt;
  template &lt;typename U&gt;
  int Out&lt;T&gt;::template In&lt;U&gt;::var;
  </code></pre>
  
  <p>gcc gives the error:</p>
  
  <pre><code>error: template definition of non-template ‘int Out&lt;T&gt;::In&lt;U&gt;::var’
   int Out&lt;T&gt;::template In&lt;U&gt;::var;
                               ^~~
  </code></pre>
  
  <p>What do I gotta do to make gcc happy?</p>
  
  <hr>
  
  <p>Edit: turns out getting rid of <code>template</code> make this work:</p>
  
  <pre><code>template &lt;typename T&gt;
  template &lt;typename U&gt;
  int Out&lt;T&gt;::In&lt;U&gt;::var;
  </code></pre>
  
  <p>Which still leaves the question, is <code>template</code> allowed here?</p>