From patchwork Sat Oct 29 02:02:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 122522 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]) by ozlabs.org (Postfix) with SMTP id A0460B6F6B for ; Sat, 29 Oct 2011 13:03:01 +1100 (EST) Received: (qmail 11109 invoked by alias); 29 Oct 2011 02:02:47 -0000 Received: (qmail 11091 invoked by uid 22791); 29 Oct 2011 02:02:45 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 29 Oct 2011 02:02:30 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p9T22SIC007025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 29 Oct 2011 02:02:29 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p9T22SIA002767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 29 Oct 2011 02:02:28 GMT Received: from abhmt117.oracle.com (abhmt117.oracle.com [141.146.116.69]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p9T22Mr4028356; Fri, 28 Oct 2011 21:02:23 -0500 Received: from [192.168.1.4] (/79.17.190.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 28 Oct 2011 19:02:22 -0700 Message-ID: <4EAB5EA4.2070705@oracle.com> Date: Sat, 29 Oct 2011 04:02:12 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 50901 X-IsSubscribed: yes 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 Hi, this is a rather nasty 4.6/4.7 Regression, ice-on-valid, and the fix seems simple. Anyway, tested (for real ;) on x86_64-linux. Ok mainline and branch? Thanks, Paolo. ///////////////// /cp 2011-10-28 Paolo Carlini PR c++/50901 * call.c (build_new_op_1): Handle ABS_EXPR together with the other unary EXPR. /testsuite 2011-10-28 Paolo Carlini PR c++/50901 * g++.dg/cpp0x/pr50901.C: New. Index: testsuite/g++.dg/cpp0x/pr50901.C =================================================================== --- testsuite/g++.dg/cpp0x/pr50901.C (revision 0) +++ testsuite/g++.dg/cpp0x/pr50901.C (revision 0) @@ -0,0 +1,9 @@ +// { dg-options "-std=c++0x" } + +template int foo(int a) +{ + const unsigned b = a < 0 ? -a : a; + return 0; +} + +int i = foo(1); Index: cp/call.c =================================================================== --- cp/call.c (revision 180626) +++ cp/call.c (working copy) @@ -5223,6 +5223,7 @@ build_new_op_1 (enum tree_code code, int flags, tr case POSTDECREMENT_EXPR: case REALPART_EXPR: case IMAGPART_EXPR: + case ABS_EXPR: return cp_build_unary_op (code, arg1, candidates != 0, complain); case ARRAY_REF: