From patchwork Thu Jun 14 14:00:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 929448 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-479725-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="PCH22Z4h"; dkim-atps=neutral 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 4164zv4hmXz9s01 for ; Fri, 15 Jun 2018 00:01:47 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=NW5Jg/46TMKShz4jB2qpla6oCbqbThTJlKbE/7Vp5HcV5Igl7On7r JJUP0AOzMTnl85PuQrsPpbgjgNiOrytNB+iEtV7d4XucIVdM/lojo3Xs1LUkhCXq gxyiLg3Rztzutb3IhRW/HgIhKtXXMD6F1EmQa9o8fKQSNC5kFJf7ys= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=Mds3AXveZrTP7dgboNigTu0V04U=; b=PCH22Z4hTbT0T/LYIV+r pGYflD1EGxH6pYSv0O2O+bIJIzKEGQRluKt3hQp0tMQEAz40pUJxsbHopDtHj7QD mFfoXks1Krz83Of0ruM68cvQiGalm0321rR/icuCD44WT4l0bRj/rCee77/Rnp4g XhGG91K/10+/VRyPbl3yl1Y= Received: (qmail 60300 invoked by alias); 14 Jun 2018 14:01:30 -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 57326 invoked by uid 89); 14 Jun 2018 14:01:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Jun 2018 14:00:58 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 745F040122CE; Thu, 14 Jun 2018 14:00:56 +0000 (UTC) Received: from localhost (unknown [10.33.36.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 276C42166BB2; Thu, 14 Jun 2018 14:00:55 +0000 (UTC) Date: Thu, 14 Jun 2018 15:00:55 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Define __cpp_lib_tuple_element_t in not Message-ID: <20180614140055.GA6899@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.2 (2017-12-15) During the review of P0941R2 in Rapperswil we noticed that SD-6 puts the macro __cpp_lib_tuple_element_t in , but it should be in . * include/std/tuple (__cpp_lib_tuple_element_t): Move feature test macro from and change type to long. * include/std/utility (__cpp_lib_tuple_element_t): Remove. * testsuite/20_util/tuple/tuple_element_t.cc: Check for feature test macro. Tested x86_64-linux, committed to trunk. commit 4f01bc22bdabe1fd70e9bf67cfed07880eb2f754 Author: Jonathan Wakely Date: Thu Jun 14 14:41:50 2018 +0100 Define __cpp_lib_tuple_element_t in not * include/std/tuple (__cpp_lib_tuple_element_t): Move feature test macro from and change type to long. * include/std/utility (__cpp_lib_tuple_element_t): Remove. * testsuite/20_util/tuple/tuple_element_t.cc: Check for feature test macro. diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 16f69220abb..0f890504889 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1298,6 +1298,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "tuple index is in range"); }; +#if __cplusplus >= 201402L +#define __cpp_lib_tuple_element_t 201402L + + template + using tuple_element_t = typename tuple_element<__i, _Tp>::type; +#endif + template constexpr _Head& __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept @@ -1338,7 +1345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::forward(std::get<__i>(__t)); } -#if __cplusplus > 201103L +#if __cplusplus >= 201402L #define __cpp_lib_tuples_by_type 201304 @@ -1470,6 +1477,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2275. Why is forward_as_tuple not constexpr? + /// std::forward_as_tuple template constexpr tuple<_Elements&&...> forward_as_tuple(_Elements&&... __args) noexcept diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index c9695006ff1..7bf80de3745 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -135,13 +135,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename add_cv<__tuple_element_t<__i, _Tp>>::type type; }; -#if __cplusplus > 201103L -#define __cpp_lib_tuple_element_t 201402 - - template - using tuple_element_t = typename tuple_element<__i, _Tp>::type; -#endif - // Various functions which give std::pair a tuple-like interface. /// Partial specialization for std::pair diff --git a/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc b/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc index 8f7aa58d34e..6b1b7a54251 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc @@ -19,6 +19,12 @@ #include +#ifndef __cpp_lib_tuple_element_t +# error "Feature-test macro for tuple_element_t missing" +#elif __cpp_lib_tuple_element_t != 201402 +# error "Feature-test macro for tuple_element_t has wrong value" +#endif + using namespace std; struct foo