title: C enum definition in struct with typedef
body: <p>I found some problem with definition of enum inside a struct, I want to have something like:</p>
  
  <pre><code>typedef struct
  {
      typedef enum { E1, E2, E3 } E;
      E e;
  } S;
  </code></pre>
  
  <p>in VS2012 I have errors:</p>
  
  <pre><code>error C2071: 'E' : illegal storage class
  error C2061: syntax error : identifier 'E'
  error C2059: syntax error : '}'
  </code></pre>
  
  <p>I found an explanation of C2071 but it is not the same case:
  <a href="http://msdn.microsoft.com/en-us/library/deb3kh5w.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/deb3kh5w.aspx</a></p>
  
  <p>gcc-4.9 says: </p>
  
  <pre><code>error: expected specifier-qualifier-list before ‘typedef’
  </code></pre>
  
  <p>the interesting thing is that the code:</p>
  
  <pre><code>typedef enum { E1, E2, E3 } E;
  E e;
  </code></pre>
  
  <p>works fine in global scope and in function's body.</p>
  
  <p>I've also tried to do it without typedef, but unfortunately there are still lot's of errors:</p>
  
  <pre><code>error C2011: 'E' : 'enum' type redefinition
  see declaration of 'E'
  error C2208: 'E' : no members defined using this type
  </code></pre>
  
  <p>I found similar reason: <a href="http://msdn.microsoft.com/en-us/library/ms927163.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms927163.aspx</a>
  but I do define members of the type.</p>