title: ‘YYSTYPE’ has no member named '--' for union type
body: <p>I have declared the YYSTYPE union as</p>
  
  <pre><code>%union
  {
          char* stringValue;
          union int_double_string* ids;
  }
  </code></pre>
  
  <p><code>int_double_string</code> is declared as</p>
  
  <pre><code>union int_double_string
  {
          short type;     //0:int 1:double 2:string
          int intValue;
          double doubleValue;
          char* stringValue;
  };
  </code></pre>
  
  <p>Some tokens</p>
  
  <pre><code>%token &lt;stringValue&gt; KEY
  %token &lt;int_double_string&gt; VALUE
  %token &lt;stringValue&gt; COMMENT    
  %type &lt;stringValue&gt; pair
  %type &lt;int_double_string&gt; key_expr
  </code></pre>
  
  <p>But where-ever I use token <code>VALUE</code>, it gives me that common error.</p>
  
  <pre><code>‘YYSTYPE’ has no member named ‘int_double_string’
  
  pair:
          KEY ws '=' ws VALUE     {
                  char S5[15];
                  addPair($1, $5);   //Error here and where-ever I use $5 in this function
                  ...
  </code></pre>
  
  <p>Why is this so though I've declared it correctly? I've used the variable in my lex file as well. Its showing no error there.</p>
  
  <p>lex file</p>
  
  <pre><code>{integer}       {
                  yylval.ids = malloc(sizeof(union int_double_string));
                  yylval.ids-&gt;type = 0;
                  yylval.ids-&gt;intValue = atoi(yytext);
                  return VALUE;
          }
  </code></pre>
  
  <p>I think it has something to with the concept of union inside a union.</p>
  
  <p>What to do?</p>