From patchwork Mon Oct 10 12:17:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 680383 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 3sszgC0LBkz9s3s for ; Mon, 10 Oct 2016 23:18:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=CTSvfvk7; dkim-atps=neutral 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=FQKnZhmWKOyJfGXbXLOTBcpFjM1hV2z3o29FiV5bFz2P1gCvQ7uE+ YnPmKvJmvr+8cc+l1Yvf037X4kass2dwTzocWkwc7ENA0VoXJzYcX6q91ciULScr UJCYLxyUkesOeH8neoAaWxHJkka72a+qy/HxEOTwzhZNv7t03hfeoM= 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=9KKLknAjTK28gPrHKG7hT/PJ9hc=; b=CTSvfvk77RD6XwGFVlGQ HRXBeBNK9lYQ7X6ZT6gt85nba6OJ4uSwd3u+9e05ia13Pyyd8KM3A/OWAmvUVlAc HQtuW+OXeUl0MQP2APq7g85RrD9eLik82xsrSBa5f56+FFtgkF3sozb77uYyxsfK Vn1WC9kxyjzX1pebWa/gs2E= Received: (qmail 16116 invoked by alias); 10 Oct 2016 12:18:07 -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 15690 invoked by uid 89); 10 Oct 2016 12:18:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=containers, 2976, Tp1, tp1 X-Spam-User: qpsmtpd, 2 recipients 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 ESMTP; Mon, 10 Oct 2016 12:17:53 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8769DBAF7; Mon, 10 Oct 2016 12:17:52 +0000 (UTC) Received: from localhost (ovpn-116-122.ams2.redhat.com [10.36.116.122]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9ACHpTA025937; Mon, 10 Oct 2016 08:17:52 -0400 Date: Mon, 10 Oct 2016 13:17:51 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Define std::allocator::is_always_equal Message-ID: <20161010121751.GB7961@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.0 (2016-08-17) I somehow only added the is_always_equal nested typedef to the allocator specialization, not the primary template. All the containers still do the right thing, because they use allocator_traits>::is_always_equal which gives the right answer, but we still need to provide allocator::is_always_equal to be conforming. * include/bits/allocator.h (allocator::is_always_equal): Define. * testsuite/20_util/allocator/requirements/typedefs.cc: Test for is_always_equal. * testsuite/util/testsuite_allocator.h (uneq_allocator::is_always_equal): Define as false_type. Tested powerpc64le-linux, committed to trunk/ commit f5020f0fa1dc815eda37d8b1040e7c16f1554114 Author: Jonathan Wakely Date: Mon Oct 10 12:04:24 2016 +0100 Define std::allocator::is_always_equal * include/bits/allocator.h (allocator::is_always_equal): Define. * testsuite/20_util/allocator/requirements/typedefs.cc: Test for is_always_equal. * testsuite/util/testsuite_allocator.h (uneq_allocator::is_always_equal): Define as false_type. diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 984d800..8e78165 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -50,6 +50,9 @@ #endif #define __cpp_lib_incomplete_container_elements 201505 +#if __cplusplus >= 201103L +# define __cpp_lib_allocator_is_always_equal 201411 +#endif namespace std _GLIBCXX_VISIBILITY(default) { @@ -80,7 +83,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // 2103. std::allocator propagate_on_container_move_assignment typedef true_type propagate_on_container_move_assignment; -#define __cpp_lib_allocator_is_always_equal 201411 typedef true_type is_always_equal; #endif }; @@ -113,6 +115,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. std::allocator propagate_on_container_move_assignment typedef true_type propagate_on_container_move_assignment; + + typedef true_type is_always_equal; #endif allocator() throw() { } diff --git a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc index 028daa9..1b3f14f 100644 --- a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc @@ -48,3 +48,6 @@ static_assert( is_same::rebind::other, static_assert( is_same::propagate_on_container_move_assignment, std::true_type>::value, "propagate_on_container_move_assignment" ); + +static_assert( is_same::is_always_equal, std::true_type>::value, + "is_always_equal" ); diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index 8537a83..dd7e22d 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -297,6 +297,7 @@ namespace __gnu_test #if __cplusplus >= 201103L typedef std::true_type propagate_on_container_swap; + typedef std::false_type is_always_equal; #endif template