title: How to warn when assigning or performing arithmetic with different enum types in GCC?
body: <p>While I'm aware this is valid C not to differentiate between enum types.</p>
  
  <p>GCC does have <code>-Wenum-compare</code> (which I'm using) and works as expected.</p>
  
  <p>I tried using <code>-Wconversion</code> but this doesn't make any difference.</p>
  
  <p>How can assignments and arithmetic operators (<code>+</code>/<code>-</code>/<code>&amp;</code>/<code>|</code>... etc) also generate warnings? (assignment, or and... etc)</p>
  
  <pre><code>{
      enum Foo f = SOME_VALUE;
      enum Bar b = SOME_OTHER_VALUE;
  
      if (f != b) {
          /* this warns! */
      }
  
      f = b;  /* &lt;-- how to warn about this? */
      f |= b;  /* .. and this? */
  
  }
  </code></pre>
  
  <hr>
  
  <p>Notes:</p>
  
  <ul>
  <li>Switching to C++ is not an option <em>(as suggested in other answers)</em>.</li>
  <li><a href="https://stackoverflow.com/questions/4669454">This question</a> is closely related, however its not a duplicate because it's about passing arguments instead of arithmetic.</li>
  </ul>