This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/60978] [4.9 Regression] -Wenum-compare warns too eagerly
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 27 Apr 2014 22:59:14 +0000
- Subject: [Bug c++/60978] [4.9 Regression] -Wenum-compare warns too eagerly
- Auto-submitted: auto-generated
- References: <bug-60978-4 at http dot gcc dot gnu dot org/bugzilla/>
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