From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52605 invoked by alias); 9 Jun 2015 07:52:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 52565 invoked by uid 89); 9 Jun 2015 07:51:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 09 Jun 2015 07:51:58 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45358) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1Z2EKB-0007zv-O6 for gcc-patches@gnu.org; Tue, 09 Jun 2015 03:51:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2EK7-000331-5k for gcc-patches@gnu.org; Tue, 09 Jun 2015 03:51:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2EK6-000325-WB for gcc-patches@gnu.org; Tue, 09 Jun 2015 03:51:51 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B62C319CBC6; Tue, 9 Jun 2015 07:51:49 +0000 (UTC) Received: from redhat.com (ovpn-204-27.brq.redhat.com [10.40.204.27]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t597pkB4005054 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Tue, 9 Jun 2015 03:51:48 -0400 Date: Tue, 09 Jun 2015 07:53:00 -0000 From: Marek Polacek To: Mikhail Maltsev Cc: Jason Merrill , gcc-patches Subject: Re: [Patch, C++, PR65882] Check tf_warning flag in build_new_op_1 Message-ID: <20150609075145.GS2756@redhat.com> References: <553CC7D2.5050708@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <553CC7D2.5050708@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-SW-Source: 2015-06/txt/msg00632.txt.bz2 This is not my patch, but I'd like to ping it anyway as it also fixes PR66467 (you might want to add a testcase from this PR as well). On Sun, Apr 26, 2015 at 02:11:14PM +0300, Mikhail Maltsev wrote: > The attached patch was bootstrapped and regtested on > x86_64-unknown-linux-gnu. > > -- > Regards, > Mikhail Maltsev > gcc/cp/ChangeLog: > > 2015-04-26 Mikhail Maltsev > > * call.c (build_new_op_1): Check tf_warning flag in all cases > > gcc/testsuite/ChangeLog: > > 2015-04-26 Mikhail Maltsev > > * g++.dg/diagnostic/inhibit-warn.C: New test. > > > diff --git a/gcc/cp/call.c b/gcc/cp/call.c > index 7bdf236..689d542 100644 > --- a/gcc/cp/call.c > +++ b/gcc/cp/call.c > @@ -5677,8 +5677,9 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1, > case TRUTH_ORIF_EXPR: > case TRUTH_AND_EXPR: > case TRUTH_OR_EXPR: > - warn_logical_operator (loc, code, boolean_type_node, > - code_orig_arg1, arg1, code_orig_arg2, arg2); > + if (complain & tf_warning) > + warn_logical_operator (loc, code, boolean_type_node, > + code_orig_arg1, arg1, code_orig_arg2, arg2); > /* Fall through. */ > case GT_EXPR: > case LT_EXPR: > @@ -5686,8 +5687,9 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1, > case LE_EXPR: > case EQ_EXPR: > case NE_EXPR: > - if ((code_orig_arg1 == BOOLEAN_TYPE) > - ^ (code_orig_arg2 == BOOLEAN_TYPE)) > + if ((complain & tf_warning) > + && ((code_orig_arg1 == BOOLEAN_TYPE) > + ^ (code_orig_arg2 == BOOLEAN_TYPE))) > maybe_warn_bool_compare (loc, code, arg1, arg2); > /* Fall through. */ > case PLUS_EXPR: > diff --git a/gcc/testsuite/g++.dg/diagnostic/inhibit-warn.C b/gcc/testsuite/g++.dg/diagnostic/inhibit-warn.C > new file mode 100644 > index 0000000..5655eb4 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/diagnostic/inhibit-warn.C > @@ -0,0 +1,32 @@ > +// PR c++/65882 > +// { dg-do compile { target c++11 } } > +// { dg-options "-Wbool-compare" } > + > +// Check that we don't ICE because of reentering error reporting routines while > +// evaluating template parameters > + > +template > +struct type_function { > + static constexpr bool value = false; > +}; > + > +template > +struct dependent_type { > + typedef int type; > +}; > + > +template > +typename dependent_type<(5 > type_function::value)>::type > +bar(); > + > +template > +typename dependent_type<(5 > type_function::value)>::type > +foo() > +{ > + return bar(); > +} > + > +int main() > +{ > + foo(); > +} Marek