From patchwork Thu Jul 30 20:23:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1339034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=T+XuLFpO; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BHhgw0qYXz9sT6 for ; Fri, 31 Jul 2020 06:23:39 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AC4623857C5D; Thu, 30 Jul 2020 20:23:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC4623857C5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596140615; bh=qm76NA6SJHzhECOjgNeCQCJ9UqbF1dwQBzyBdUgWT4A=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=T+XuLFpOlZxcR7lLZVmsGD/T4YBBV2KX5s2qMMYpCRSFKJXOfEzh9BoaXF8+cBsPR TLZycAJkWtxVq4rwl1/zSs46xvVntYarAcSNrOt5UpVxWiyD9nFu3fBbpdberT4qCE wtiUutsWVIIumQx/LZUxCaixbHc3pMGdeV+nsXPM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id BEEBC3857C40 for ; Thu, 30 Jul 2020 20:23:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BEEBC3857C40 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-bxhXOLodP8itnnS7d7lnVA-1; Thu, 30 Jul 2020 16:23:30 -0400 X-MC-Unique: bxhXOLodP8itnnS7d7lnVA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BFE3B800473; Thu, 30 Jul 2020 20:23:29 +0000 (UTC) Received: from localhost (unknown [10.33.36.241]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AF2E69334; Thu, 30 Jul 2020 20:23:29 +0000 (UTC) Date: Thu, 30 Jul 2020 21:23:28 +0100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Make COW string use allocator_traits for nested types Message-ID: <20200730202328.GA1151498@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" When compiled as C++20 the COW std::string fails due to assuming that the allocator always defines size_type and difference_type. That has been incorrect since C++11, but we got away with it for specializations using std::allocator until those members were removed in C++20. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (size_type, difference_type): Use allocator_traits to obtain the allocator's size_type and difference_type. Tested powerpc64le-linux. Committed to trunk. commit 684d6ee140af6585c18c8790f8f5bddfcc6bd153 Author: Jonathan Wakely Date: Thu Jul 30 20:58:09 2020 libstdc++: Make COW string use allocator_traits for nested types When compiled as C++20 the COW std::string fails due to assuming that the allocator always defines size_type and difference_type. That has been incorrect since C++11, but we got away with it for specializations using std::allocator until those members were removed in C++20. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (size_type, difference_type): Use allocator_traits to obtain the allocator's size_type and difference_type. diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index bc0c256b65e..52cecdd7ca1 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -3147,8 +3147,8 @@ _GLIBCXX_END_NAMESPACE_CXX11 typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef _Alloc allocator_type; - typedef typename _CharT_alloc_type::size_type size_type; - typedef typename _CharT_alloc_type::difference_type difference_type; + typedef typename _CharT_alloc_traits::size_type size_type; + typedef typename _CharT_alloc_traits::difference_type difference_type; #if __cplusplus < 201103L typedef typename _CharT_alloc_type::reference reference; typedef typename _CharT_alloc_type::const_reference const_reference;