From patchwork Thu Apr 14 14:57:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 91247 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 6928FB6EF0 for ; Fri, 15 Apr 2011 00:57:36 +1000 (EST) Received: (qmail 30000 invoked by alias); 14 Apr 2011 14:57:33 -0000 Received: (qmail 29990 invoked by uid 22791); 14 Apr 2011 14:57:32 -0000 X-SWARE-Spam-Status: No, hits=-6.3 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; Thu, 14 Apr 2011 14:57:21 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3EEvKSO024698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Apr 2011 10:57:20 -0400 Received: from [127.0.0.1] ([10.3.113.3]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3EEvJ19024194 for ; Thu, 14 Apr 2011 10:57:20 -0400 Message-ID: <4DA70B4F.2000705@redhat.com> Date: Thu, 14 Apr 2011 10:57:19 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/48557 (SFINAE failure with void operands) 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 We were just failing to check complain for this one error. Tested x86_64-pc-linux-gnu, applying to trunk. commit e807a327e3e667c8d79356cf644e493fbb82033f Author: Jason Merrill Date: Wed Apr 13 18:14:45 2011 -0400 PR c++/48557 * typeck.c (cp_build_binary_op): Don't decay void operands. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index ecd7d41..b0e2110 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3646,16 +3646,16 @@ cp_build_binary_op (location_t location, || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR || code == TRUTH_XOR_EXPR) { - if (!really_overloaded_fn (op0)) + if (!really_overloaded_fn (op0) && !VOID_TYPE_P (TREE_TYPE (op0))) op0 = decay_conversion (op0); - if (!really_overloaded_fn (op1)) + if (!really_overloaded_fn (op1) && !VOID_TYPE_P (TREE_TYPE (op1))) op1 = decay_conversion (op1); } else { - if (!really_overloaded_fn (op0)) + if (!really_overloaded_fn (op0) && !VOID_TYPE_P (TREE_TYPE (op0))) op0 = default_conversion (op0); - if (!really_overloaded_fn (op1)) + if (!really_overloaded_fn (op1) && !VOID_TYPE_P (TREE_TYPE (op1))) op1 = default_conversion (op1); } diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae14.C b/gcc/testsuite/g++.dg/cpp0x/sfinae14.C new file mode 100644 index 0000000..305f96e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae14.C @@ -0,0 +1,27 @@ +// PR c++/48557 +// { dg-options -std=c++0x } + +template +struct add_rval_ref +{ + typedef T&& type; +}; + +template<> +struct add_rval_ref +{ + typedef void type; +}; + +template +typename add_rval_ref::type create(); + +template() + create()) +> +char f(int); + +template +char (&f(...))[2]; + +static_assert(sizeof(f(0)) != 1, "Error"); // (a)