title: C initialize const struct member with existing const variable
body: <p>I'm using default C under gcc.</p>
  
  <p>My code:</p>
  
  <pre><code>typedef struct _OpcodeEntry OpcodeEntry;
  </code></pre>
  
  <p>//</p>
  
  <pre><code>struct _OpcodeEntry
  {
      unsigned char uOpcode;
      OpcodeMetadata pMetadata;
  };
  </code></pre>
  
  <p>//</p>
  
  <pre><code>const OpcodeMetadata omCopyBytes1 = { 1, 1, 0, 0, 0, 0, &amp;CopyBytes };
  
  const OpcodeEntry pOpcodeTable[] =
  {
      { 0x0, omCopyBytes1 },
  };
  </code></pre>
  
  <p>Errors:</p>
  
  <pre><code>error: initializer element is not constant
  error: (near initialization for 'pOpcodeTable[0].pMetadata')
  </code></pre>
  
  <p>If I change <code>omCopyBytes1</code> to what it's actually set to in the above line, the code compiles fine. What am I doing wrong?</p>