title: Defining a class in a template argument, why is it invalid?
body: <p>Suppose the code:</p>
  
  <pre><code>template &lt;class T&gt;
  class X {  };
  
  int main(void) {
      X&lt;class {
          int a;
      }&gt; x;
      return 0;
  }
  </code></pre>
  
  <p>g++ 5.1 gives the following error message:</p>
  
  <pre><code>prog.cpp: In function 'int main()':
  prog.cpp:5:10: error: types may not be defined in template arguments
    X&lt;class {
            ^
  prog.cpp:7:2: error: expected ';' after class definition
    }&gt; x;
    ^
  prog.cpp:7:2: error: expected template-argument before ';' token
  prog.cpp:7:2: error: expected '&gt;' before ';' token
  prog.cpp:7:2: error: 'main()::&lt;anonymous class&gt;' is/uses anonymous type
  prog.cpp:7:2: error:   trying to instantiate 'template&lt;class T&gt; class X'
  prog.cpp:7:2: error: expected '::' before ';' token
  prog.cpp:7:2: error: expected identifier before ';' token
  prog.cpp:7:3: error: expected primary-expression before '&gt;' token
    }&gt; x;
     ^
  prog.cpp:7:5: error: 'x' was not declared in this scope
    }&gt; x;
       ^
  </code></pre>
  
  <p>The second line of the error output says that we can't define types in template arguments. Why is it invalid? (I mean, I know it's invalid in the standard, but what's the reason for that?)</p>