[Bug c++/60978] [4.9 Regression] -Wenum-compare warns too eagerly
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Apr 27 22:59:00 GMT 2014
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
More information about the Gcc-bugs
mailing list