From: Jonathan Wakely <jwakely@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] libstdc++: Use function object for __decay_copy helper
Date: Wed, 16 Jun 2021 14:38:26 +0100 [thread overview]
Message-ID: <CACb0b4mKPUDDf3aY06=FjEZySJJeyBv3FXR6f5qqK_cSy+m30Q@mail.gmail.com> (raw)
In-Reply-To: <YMjxJMSLuAx03qVU@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]
On Tue, 15 Jun 2021 at 19:28, Jonathan Wakely wrote:
>
> By changing __cust_access::__decay_copy from a function template to a
> function object we avoid ADL. That means it's fine to call it
> unqualified (the compiler won't waste time doing ADL in associated
> namespaces, and won't try to complete associated types).
>
> This also makes some other minor simplications to other concepts for the
> [range.access] CPOs.
>
> Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/iterator_concepts.h (__cust_access::__decay_copy):
> Replace with function object.
> (__cust_access::__member_begin, ___cust_access::_adl_begin): Use
> __decay_copy unqualified.
> * include/bits/ranges_base.h (__member_end, __adl_end):
> Likewise. Use __range_iter_t for type of ranges::begin.
> (__member_rend): Use correct value category for rbegin argument.
> (__member_data): Use __decay_copy unqualified.
> (__begin_data): Use __range_iter_t for type of ranges::begin.
That change makes it impossible to import the header in a module.
Fixed by this patch.
Tested powerpc64le-linux. Pushed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1249 bytes --]
commit c25e3bf87975280a603ff18fba387c6707ce4a95
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Jun 16 12:47:32 2021
libstdc++: Use named struct for __decay_copy
In r12-1486-gcb326a6442f09cb36b05ce556fc91e10bfeb0cf6 I changed
__decay_copy to be a function object of unnamed class type. This causes
problems when importing the library headers:
error: conflicting global module declaration 'constexpr const std::ranges::__cust_access::<unnamed struct> std::ranges::__cust_access::__decay_copy'
The fix is to use a named struct instead of an anonymous one.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/iterator_concepts.h (__decay_copy): Name type.
diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h
index d18ae32bf20..11748e5ed7b 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -930,7 +930,8 @@ namespace ranges
{
using std::__detail::__class_or_enum;
- struct {
+ struct _Decay_copy final
+ {
template<typename _Tp>
constexpr decay_t<_Tp>
operator()(_Tp&& __t) const
prev parent reply other threads:[~2021-06-16 13:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 18:27 Jonathan Wakely
2021-06-16 13:38 ` Jonathan Wakely [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACb0b4mKPUDDf3aY06=FjEZySJJeyBv3FXR6f5qqK_cSy+m30Q@mail.gmail.com' \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).