From patchwork Thu Dec 18 22:20:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 422673 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 296EE1400B7 for ; Fri, 19 Dec 2014 09:20:43 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=SiArWT3IFW7MOjI47Zbhf95iNniTFsEQ5mwkc7I5aG4+GJ VOcUAjlSTwVKgiMR7d7MZtCn/F7AvDfSVmrQA1y9mHA4eUF2OED2fWn61FTx9ICw znkkZ7eAEAszYtaIF4N3SWFY8HQ26S6SkQBaybYEv12bH6DB9VnuB8lF3hJbY= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=1ifp+j/MqI50cqEavnofUOtM2To=; b=ll/DcAr1hj/I1QyYkwF5 nFPcHVa+5oUX9q8abEFYwOj40Tw/RR46sp81uMZGNvPn4eJI4o/0RBj9eWvw+4p8 0yup9ztOzqzL3s8mIJxrCj+rO00En5ZknNW0Lmig3wlBp4QW134v9Q8M1pk8KSuF 86+jWCWb7LLhAiSP5p4UPFg= Received: (qmail 14250 invoked by alias); 18 Dec 2014 22:20:37 -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 14238 invoked by uid 89); 18 Dec 2014 22:20:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 18 Dec 2014 22:20:35 +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 sBIMKXsN025660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 18 Dec 2014 17:20:34 -0500 Received: from [10.3.113.56] (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBIMKXt6026010 for ; Thu, 18 Dec 2014 17:20:33 -0500 Message-ID: <54935330.6090602@redhat.com> Date: Thu, 18 Dec 2014 17:20:32 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/64352 (decltype and SFINAE) We were just missing a case where we want to pass complain down to avoid a hard error in SFINAE context. Tested x86_64-pc-linux-gnu, applying to trunk. commit 83bea8460ce8e14e5b9d1c0dc33a0d22b63b566d Author: Jason Merrill Date: Thu Dec 18 12:42:34 2014 -0500 PR c++/64352 * pt.c (tsubst_copy_and_build): Pass complain to mark_used. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 8a663d9..3ddee25 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15125,7 +15125,7 @@ tsubst_copy_and_build (tree t, /* Remember that there was a reference to this entity. */ if (DECL_P (function)) - mark_used (function); + mark_used (function, complain); /* Put back tf_decltype for the actual call. */ complain |= decltype_flag; diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted9.C b/gcc/testsuite/g++.dg/cpp0x/deleted9.C new file mode 100644 index 0000000..af97be7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/deleted9.C @@ -0,0 +1,31 @@ +// PR c++/64352 +// { dg-do compile { target c++11 } } + +template struct bool_type +{ static constexpr bool value = B; }; + +using true_type = bool_type; +using false_type = bool_type; + +template T&& declval(); + +template struct void_ { using type = void; }; +template using void_t = typename void_::type; + +template +struct _Has_addressof_free: false_type { }; + +template +struct _Has_addressof_free +<_Tp, void_t()) )>> +: true_type { }; + +struct foo {}; +void operator&(foo) = delete; + +int main() +{ + static_assert( !_Has_addressof_free::value, "" ); + // error: use of deleted function 'void operator&(foo)' + static_assert( !_Has_addressof_free::value, "" ); +}