This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/60978] [4.9 Regression] -Wenum-compare warns too eagerly


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60978

--- Comment #4 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
(In reply to Manuel LÃpez-IbÃÃez from comment #3)
> I don't even understand what this code is trying to warn about:
> 
>       if (TREE_CODE (arg2_type) == ENUMERAL_TYPE
> 	  && TREE_CODE (arg3_type) == ENUMERAL_TYPE)
>         {
> 	  if (TREE_CODE (orig_arg2) == CONST_DECL
> 	      && TREE_CODE (orig_arg3) == CONST_DECL
> 	      && DECL_CONTEXT (orig_arg2) == DECL_CONTEXT (orig_arg3))
> 	    /* Two enumerators from the same enumeration can have different
> 	       types when the enumeration is still being defined.  */;
>           else if (complain & tf_warning)
>             warning_at (loc, OPT_Wenum_compare, "enumeral mismatch in "
> 			"conditional expression: %qT vs %qT",
> 			arg2_type, arg3_type);
>         }
> 
> What is the DECL_CONTEXT check doing there?

No I remember it is because of
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53524#c19

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]