title: Inner class depending on a template argument
body: <p>Consider next example :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;typeinfo&gt;
  
  template&lt; int N, typename T &gt;
  struct B
  {
      struct C;
  };
  
  template&lt; typename T &gt;
  struct B&lt; 0, T &gt;::C
  {
      typedef T type;
  };
  
  template&lt; int N, typename T &gt;
  struct B&lt; N, T &gt;::C
  {
      typedef T type[N];
  };
  
  int main()
  {
      std::cout&lt;&lt;"n=0   type = " &lt;&lt; typeid( B&lt; 0, float &gt;::C::type ).name() &lt;&lt; std::endl;
      std::cout&lt;&lt;"n=5   type = " &lt;&lt; typeid( B&lt; 5, float &gt;::C::type ).name() &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>When compiled using g++ (version 4.3.0)</p>
  
  <pre><code>g++ dfg.cpp  -ansi -pedantic -Wall
  </code></pre>
  
  <p>the compile error is :</p>
  
  <pre><code>dfg.cpp:13: error: qualified name does not name a class before ‘{’ token
  dfg.cpp: In instantiation of ‘B&lt;0, float&gt;::C’:
  dfg.cpp:25:   instantiated from here
  dfg.cpp:20: error: ISO C++ forbids zero-size array
  </code></pre>
  
  <p>What I am really trying to archive is to have different Imp implementation depending on the enum value (in the example, instead of an enum, I used int, but it shouldn't matter).</p>
  
  <p>Can someone explain why is this not allowed?
  Why am I getting the first error?
  (this one : qualified name does not name a class before ‘{’ token)</p>
  
  <hr>
  
  <p>Regarding the pimpl implementation depending on a template parameter, I created a new question (with better example) <a href="https://stackoverflow.com/questions/5425065/c-pimpl-idiom-implementation-depending-on-a-template-parameter">here</a></p>