From patchwork Fri Aug 6 19:34:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 61134 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 B5AE1B6EEC for ; Sat, 7 Aug 2010 05:34:29 +1000 (EST) Received: (qmail 1701 invoked by alias); 6 Aug 2010 19:34:28 -0000 Received: (qmail 1693 invoked by uid 22791); 6 Aug 2010 19:34:27 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Aug 2010 19:34:22 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o76JYKpH025761 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 6 Aug 2010 15:34:20 -0400 Received: from [IPv6:::1] (ovpn-113-50.phx2.redhat.com [10.3.113.50]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o76JYJRo028554 for ; Fri, 6 Aug 2010 15:34:20 -0400 Message-ID: <4C5C63B9.6040004@redhat.com> Date: Fri, 06 Aug 2010 21:34:17 +0200 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100802 Lightning/1.0b1 Shredder/3.0.7pre MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for nullptr decay 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 On the constexpr branch, some testcases were confused by nullptr_t variables not clearly having a constant value. I've fixed this by causing them to decay to nullptr. Tested x86_64-pc-linux-gnu, applied to trunk. commit 171913d18ec1a2ccefc1921cf259cdef1ca37dac Author: Jason Merrill Date: Fri Aug 6 20:10:29 2010 +0200 * typeck.c (decay_conversion): Any expression with type nullptr_t decays to nullptr. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 484d299..177f4bb 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1920,6 +1920,9 @@ decay_conversion (tree exp) if (error_operand_p (exp)) return error_mark_node; + if (NULLPTR_TYPE_P (type)) + return nullptr_node; + /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue. Leave such NOP_EXPRs, since RHS is being used in non-lvalue context. */ code = TREE_CODE (type);