title: Enum within structure : comparison between '' and 'enum <anonymous>
body: <p>typedef enum </p>
  
  <pre><code>{
  
      var1,var2
  
  }enum1;
  
   typedef enum 
  
  {
  
    var3,var4 = 8
  
  }enum2;
  
  struct struct1
  
  {
  
    enum1 e1;
  
    enum2 e2;
  
  };
  
  int main()
  
  {
  
    struct struct1 *s1;
  
  
    if (s1 -&gt; e1 == var4)
  </code></pre>
  
  <p>This code throws the warning :</p>
  
  <p>comparison between 'enum1' and 'enum ' [-Wenum-compare].</p>
  
  <p>Though after reading <a href="https://stackoverflow.com/questions/10899491/set-one-enum-equal-to-another">Set one enum equal to another</a>, and changing the code as </p>
  
  <blockquote>
    <p>s1 -> e1 ==(enum1) (int)var4</p>
  </blockquote>
  
  <p>I m unable to resolve.  </p>
  
  <p>Some suggestions to clear warning will be of great help :)</p>