title: Passing pointer-to-enum to pointer-to-int output parameter
body: <p>I have code similar to the following:</p>
  
  <pre><code>void generateInt(int *result)
  {
    /* chosen by fair dice roll*/
    *result = 1;
  }
  
  typedef enum colour
  {
    RED,
    GREEN,
    BLUE
  } COLOUR;
  
  int main(int, char**)
  {
    COLOUR col, col2;
    int i;
  
    generateInt(&amp;i);
    col = (COLOUR)i;
  
    generateInt((int*)(&amp;col2));
  
    return 0;
  }
  </code></pre>
  
  <p>After the second call to <code>generateInt</code>, are <code>col</code> and <code>col2</code> both guaranteed to be equal to <code>GREEN</code>? I know the first version setting <code>col</code> is legal, but I don't know whether it's defined what happens if you cast pointer-to-enum to pointer-to-int, and then assign through the pointer.</p>