From patchwork Tue Jan 29 00:48:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1032418 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-494877-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="BjJBpXUq"; 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 43pSYn0Bf2z9sDB for ; Tue, 29 Jan 2019 11:49:16 +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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=HGtPeMoEeApMXZAqDNl3Yv5nAX271wuU1VeEoKDekb+yVCX7YsuxC EGMwg3AUYRVIuI4mKyiyZNZbAKf4sH9yKKnqqe4yIbCVUJqRVspZnTdjZPQt1nFo WeWoRgegICsgtX3cdc5LAvwoBVifsv0NB8SHwlfG9cExJyzUFW38Cs= 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=JL3e2XCWTU7hY7r0cQPfdsePg6k=; b=BjJBpXUq4SmtBS5dvZBQ wuxPcOV1TKwrzLCJ1SYjn6K5qK5LLPuDZ1kDPCZg1mMjlr2TQ9che4dz2ooZ1myC Z6d+Fm/Jrd9Lf1hGgvtB3SSnexZJYed88cd3MADw9V8FToJCr5cwGJIOjovt2PtM j3weQDZgKdyK4wBZL1s/EEs= Received: (qmail 92682 invoked by alias); 29 Jan 2019 00:48:46 -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 91700 invoked by uid 89); 29 Jan 2019 00:48:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=unavailable version=3.3.2 spammy=erase, qualify 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; Tue, 29 Jan 2019 00:48:06 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4117BC05D3EC; Tue, 29 Jan 2019 00:48:05 +0000 (UTC) Received: from localhost (unknown [10.33.36.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id DECF368701; Tue, 29 Jan 2019 00:48:04 +0000 (UTC) Date: Tue, 29 Jan 2019 00:48:04 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Avoid ambiguity between C++2a std::erase_if and LFTS version Message-ID: <20190129004804.GA29196@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) These calls should have been qualified to avoid ADL anyway, but in C++2a it becomes essential to qualify the calls in experimental::erase because std::erase_if is also declared and the calls become ambiguous. * include/experimental/forward_list (experimental::erase): Qualify call to erase_if. * include/experimental/list (experimental::erase): Likewise. * include/std/forward_list (std::erase): Likewise. * include/std/list (std::erase): Likewise. Tested x86_64-linux, committed to trunk. commit b9d2ffc25b406e52ce921ced97a14fcdeabd558b Author: Jonathan Wakely Date: Tue Jan 29 00:14:11 2019 +0000 Avoid ambiguity between C++2a std::erase_if and LFTS version These calls should have been qualified to avoid ADL anyway, but in C++2a it becomes essential to qualify the calls in experimental::erase because std::erase_if is also declared and the calls become ambiguous. * include/experimental/forward_list (experimental::erase): Qualify call to erase_if. * include/experimental/list (experimental::erase): Likewise. * include/std/forward_list (std::erase): Likewise. * include/std/list (std::erase): Likewise. diff --git a/libstdc++-v3/include/experimental/forward_list b/libstdc++-v3/include/experimental/forward_list index 60f0564f065..f6ffbf0a0af 100644 --- a/libstdc++-v3/include/experimental/forward_list +++ b/libstdc++-v3/include/experimental/forward_list @@ -54,7 +54,9 @@ inline namespace fundamentals_v2 erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value) { using __elem_type = typename forward_list<_Tp, _Alloc>::value_type; - erase_if(__cont, [&](__elem_type& __elem) { return __elem == __value; }); + std::experimental::erase_if(__cont, [&](__elem_type& __elem) { + return __elem == __value; + }); } namespace pmr { diff --git a/libstdc++-v3/include/experimental/list b/libstdc++-v3/include/experimental/list index 13c33f02e72..2b7a331e63a 100644 --- a/libstdc++-v3/include/experimental/list +++ b/libstdc++-v3/include/experimental/list @@ -54,7 +54,9 @@ inline namespace fundamentals_v2 erase(list<_Tp, _Alloc>& __cont, const _Up& __value) { using __elem_type = typename list<_Tp, _Alloc>::value_type; - erase_if(__cont, [&](__elem_type& __elem) { return __elem == __value; }); + experimental::erase_if(__cont, [&](__elem_type& __elem) { + return __elem == __value; + }); } namespace pmr { diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list index 3d3b6d4f5f6..9d6cc40593b 100644 --- a/libstdc++-v3/include/std/forward_list +++ b/libstdc++-v3/include/std/forward_list @@ -78,8 +78,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value) { using __elem_type = typename forward_list<_Tp, _Alloc>::value_type; - return erase_if(__cont, - [&](__elem_type& __elem) { return __elem == __value; }); + return std::erase_if(__cont, [&](__elem_type& __elem) { + return __elem == __value; + }); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list index 7b02e8685d4..8d6ac198c9a 100644 --- a/libstdc++-v3/include/std/list +++ b/libstdc++-v3/include/std/list @@ -102,8 +102,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION erase(list<_Tp, _Alloc>& __cont, const _Up& __value) { using __elem_type = typename list<_Tp, _Alloc>::value_type; - return erase_if(__cont, - [&](__elem_type& __elem) { return __elem == __value; }); + return std::erase_if(__cont, [&](__elem_type& __elem) { + return __elem == __value; + }); } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std