From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125973 invoked by alias); 18 Nov 2015 21:33:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 125886 invoked by uid 89); 18 Nov 2015 21:33:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wm0-f52.google.com Received: from mail-wm0-f52.google.com (HELO mail-wm0-f52.google.com) (74.125.82.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 18 Nov 2015 21:33:23 +0000 Received: by wmvv187 with SMTP id v187so299176438wmv.1; Wed, 18 Nov 2015 13:33:20 -0800 (PST) X-Received: by 10.28.131.84 with SMTP id f81mr6245282wmd.57.1447882400195; Wed, 18 Nov 2015 13:33:20 -0800 (PST) Received: from [192.168.0.37] (arf62-1-82-237-250-248.fbx.proxad.net. [82.237.250.248]) by smtp.googlemail.com with ESMTPSA id 193sm808057wmp.16.2015.11.18.13.33.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Nov 2015 13:33:19 -0800 (PST) To: "libstdc++@gcc.gnu.org" , gcc-patches From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= Subject: Debug iterators operator-> X-Enigmail-Draft-Status: N1110 Message-ID: <564CEE9D.3070501@gmail.com> Date: Wed, 18 Nov 2015 21:33:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070009030400060501010303" X-SW-Source: 2015-11/txt/msg02272.txt.bz2 This is a multi-part message in MIME format. --------------070009030400060501010303 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-length: 512 Hi I always wanted to fix those operators implementation so that it just use underlying iterator -> operator like for the other operators. And I also notice the @todo on it today so maybe it is still time to fix those. * include/debug/safe_iterator.h (_Safe_iterator<>::operator->()): Implement using underlying iterator same operator. * include/debug/safe_local_iterator.h (_Safe_local_iterator<>::operator->()): Likewise. Tested under Linux x86_64 debug mode of course. François --------------070009030400060501010303 Content-Type: text/x-patch; name="debug_ite.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="debug_ite.patch" Content-length: 1624 diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h index a8bee21..ed08d19 100644 --- a/libstdc++-v3/include/debug/safe_iterator.h +++ b/libstdc++-v3/include/debug/safe_iterator.h @@ -274,7 +274,6 @@ namespace __gnu_debug /** * @brief Iterator dereference. * @pre iterator is dereferenceable - * @todo Make this correct w.r.t. iterators that return proxies */ pointer operator->() const _GLIBCXX_NOEXCEPT @@ -282,7 +281,7 @@ namespace __gnu_debug _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), _M_message(__msg_bad_deref) ._M_iterator(*this, "this")); - return std::__addressof(*base()); + return base().operator->(); } // ------ Input iterator requirements ------ diff --git a/libstdc++-v3/include/debug/safe_local_iterator.h b/libstdc++-v3/include/debug/safe_local_iterator.h index 350a1d2..f60b6e9 100644 --- a/libstdc++-v3/include/debug/safe_local_iterator.h +++ b/libstdc++-v3/include/debug/safe_local_iterator.h @@ -236,7 +236,6 @@ namespace __gnu_debug /** * @brief Iterator dereference. * @pre iterator is dereferenceable - * @todo Make this correct w.r.t. iterators that return proxies */ pointer operator->() const @@ -244,7 +243,7 @@ namespace __gnu_debug _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), _M_message(__msg_bad_deref) ._M_iterator(*this, "this")); - return std::__addressof(*base()); + return base().operator->(); } // ------ Input iterator requirements ------ --------------070009030400060501010303--