From patchwork Fri Mar 3 10:26:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 734992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vZQN95FqHz9s7L for ; Fri, 3 Mar 2017 21:27:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="LBUObCSA"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=lZ6vx48CrYwNpQT+R+wRfK3bUp3FOQxtS8ZKtE9s8Na3qrL+sL Czll+Df/194qqmUoHKq8bBmUmuZgykYgCHCDsiWrdDGQkrxYcQnsfXULZq3RvP1j ZLQFZqRCg7vi5UwT4YCxH6J2YzL8ouwOUX/Y9+X42W5z2QTgSe6J4J1rY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=kGoQFRXghNwMrmy5dckiNSfcxf0=; b=LBUObCSAB//TbuxdHHC9 aeRRkjBSxBqP3sEFtLdxEbQBF5h3dVrecRg/4YIFJaNYpKv7cG7ruqfLCSztmsqU wucGXK9avzbbvF6/Pb7yVuuOA8G1Itl72f4n12bz8mnJWLuHxN/UKchS2FpIBVmN iGaVTn4V12HXoA+h7HWC2KM= Received: (qmail 102109 invoked by alias); 3 Mar 2017 10:26:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 102097 invoked by uid 89); 3 Mar 2017 10:26:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*r:ip*192.168.1.4, H*RU:192.168.1.4, Hx-spam-relays-external:192.168.1.4, 2689 X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 Mar 2017 10:26:50 +0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v23AQm0g008669 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2017 10:26:49 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v23AQmcZ022387 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2017 10:26:48 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v23AQkwL029285; Fri, 3 Mar 2017 10:26:47 GMT Received: from [192.168.1.4] (/87.11.225.246) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 03 Mar 2017 02:26:46 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 70266 Message-ID: Date: Fri, 3 Mar 2017 11:26:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, one more case of OVERLOAD filtering to cxx_eval_constant_expression and causing an ICE. In order to have a proper diagnostic early enough I think that in build_must_not_throw_expr we want to use perform_implicit_conversion_flags on the condition before calling cxx_constant_value for it. That would be also analogous to the code we already have in build_noexcept_spec, for example. Tested x86_64-linux. Thanks, Paolo. ////////////////////// /cp 2017-03-03 Paolo Carlini PR c++/70266 * except.c (build_must_not_throw_expr): Perform the implicit conversions on the condition. /testsuite 2017-03-03 Paolo Carlini PR c++/70266 * g++.dg/tm/pr70266.C: New. Index: cp/except.c =================================================================== --- cp/except.c (revision 245836) +++ cp/except.c (working copy) @@ -268,6 +268,9 @@ build_must_not_throw_expr (tree body, tree cond) if (cond && !value_dependent_expression_p (cond)) { + cond = perform_implicit_conversion_flags (boolean_type_node, cond, + tf_warning_or_error, + LOOKUP_NORMAL); cond = cxx_constant_value (cond); if (integer_zerop (cond)) return body; Index: testsuite/g++.dg/tm/pr70266.C =================================================================== --- testsuite/g++.dg/tm/pr70266.C (revision 0) +++ testsuite/g++.dg/tm/pr70266.C (working copy) @@ -0,0 +1,8 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-fgnu-tm" } + +template < typename T > +int foo (int x, T t) +{ + return __transaction_atomic noexcept (foo) (1); // { dg-error "cannot resolve" } +}