From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12244 invoked by alias); 30 May 2012 10:22:53 -0000 Received: (qmail 12235 invoked by uid 22791); 30 May 2012 10:22:52 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 May 2012 10:22:35 +0000 From: "paolo.carlini at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53524] [4.7/4.8 Regression] Bogus and unsuppressible enum comparison warning Date: Wed, 30 May 2012 10:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: paolo.carlini at oracle dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com X-Bugzilla-Target-Milestone: 4.7.1 X-Bugzilla-Changed-Fields: AssignedTo Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg02835.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53524 Paolo Carlini changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot |gnu.org |com --- Comment #6 from Paolo Carlini 2012-05-30 10:22:33 UTC --- The warnings are an unintended effect of my fix for PR16603. We warn at the end of the below lines of call.c. At the moment isn't clear to me *when* it would actually make sense to warn. Hints? /////////////////////////////////// /* [expr.cond] After those conversions, one of the following shall hold: --The second and third operands have the same type; the result is of that type. */ if (same_type_p (arg2_type, arg3_type)) result_type = arg2_type; /* [expr.cond] --The second and third operands have arithmetic or enumeration type; the usual arithmetic conversions are performed to bring them to a common type, and the result is of that type. */ else if ((ARITHMETIC_TYPE_P (arg2_type) || UNSCOPED_ENUM_P (arg2_type)) && (ARITHMETIC_TYPE_P (arg3_type) || UNSCOPED_ENUM_P (arg3_type))) { /* In this case, there is always a common type. */ result_type = type_after_usual_arithmetic_conversions (arg2_type, arg3_type); do_warn_double_promotion (result_type, arg2_type, arg3_type, "implicit conversion from %qT to %qT to " "match other result of conditional", input_location); if (TREE_CODE (arg2_type) == ENUMERAL_TYPE && TREE_CODE (arg3_type) == ENUMERAL_TYPE) { if (complain & tf_warning) warning (0, "enumeral mismatch in conditional expression: %qT vs %qT", arg2_type, arg3_type); }