From: Stephan Bergmann <sbergman@redhat.com>
To: libstdc++@gcc.gnu.org
Cc: Jonathan Wakely <jwakely@redhat.com>
Subject: Re: [committed] libstdc++: Implement LWG 1203 for rvalue iostreams
Date: Thu, 6 May 2021 17:55:54 +0200 [thread overview]
Message-ID: <6f91ec9a-888e-cfc4-8d93-9bf9d563266a@redhat.com> (raw)
In-Reply-To: <YIwKqS1groHvMeKS@redhat.com>
On 30/04/2021 15:48, Jonathan Wakely via Libstdc++ wrote:
> This implements the resolution of LWG 1203 so that the constraints for
> rvalue stream insertion/extraction are simpler, and the return type is
> the original rvalue stream type not its base class.
>
> Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
>
> libstdc++-v3/ChangeLog:
>
> * include/std/istream (operator>>(Istream&&, x&)): Simplify, as
> per LWG 1203.
> * include/std/ostream (operator<<(Ostream&&, const x&)):
> Likewise.
> * testsuite/27_io/basic_istream/extractors_character/char/lwg2499_neg.cc:
> Adjust dg-error pattern.
> * testsuite/27_io/basic_istream/extractors_character/wchar_t/lwg2499_neg.cc:
> Likewise.
> * testsuite/27_io/basic_istream/extractors_other/char/4.cc: Define
> is_extractable trait to replace std::__is_extractable. Make it
> work with rvalue streams as well as lvalues, to replace f() and
> g() helper functions.
> * testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc:
> Likewise.
> * testsuite/27_io/basic_ostream/inserters_other/char/6.cc:
> Define is_insertable trait to replace std::__is_insertable. Make
> it work with rvalue streams as well as lvalues, to replace f()
> and g() helper functions.
> * testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc:
> Likewise.
> * testsuite/27_io/filesystem/path/io/dr2989.cc: Prune additional
> errors from new constraints.
> * testsuite/27_io/rvalue_streams-2.cc: Remove PR 80675 checks,
> which are no longer expected to compile.
> * testsuite/27_io/rvalue_streams.cc: Adjust existing test.
> Verify LWG 1203 changes.
>
> Tested powerpc64le-linux. Committed to trunk.
FWIW, it looks like this is causing issues for Clang (at least Clang 11
and recent Clang 13 trunk):
> $ cat test.cc
> #include <ostream>
> int i = 1 << std::ios::erase_event;
(i.e., using and enum in namespace std),
> $ clang++ --gcc-toolchain=~/gcc/trunk/inst -fsyntax-only test.cc
> In file included from test.cc:1:
> ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:727:33: error: cannot initialize a parameter of type 'std::ios_base *' with an rvalue of type 'int *'
> __rval_streamable(ios_base* = (_Tp*)nullptr);
> ^ ~~~~~~~~~~~~~
> ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:733:25: note: in instantiation of default function argument expression for '__rval_streamable<int, void>' required here
> typename = decltype(std::__rval_streamable<_Os>()
> ^
> ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:748:12: note: in instantiation of default argument for '__rvalue_stream_insertion_t<int, std::ios_base::event>' required here
> inline __rvalue_stream_insertion_t<_Ostream, _Tp>
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> test.cc:2:11: note: while substituting deduced template arguments into function template 'operator<<' [with _Ostream = int, _Tp = std::ios_base::event]
> int i = 1 << std::ios::erase_event;
> ^
> ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ostream:727:33: note: passing argument to parameter here
> __rval_streamable(ios_base* = (_Tp*)nullptr);
> ^
> 1 error generated.
next prev parent reply other threads:[~2021-05-06 15:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-30 13:48 Jonathan Wakely
2021-05-06 15:55 ` Stephan Bergmann [this message]
2021-05-06 17:09 ` Jonathan Wakely
2021-05-06 17:28 ` Jonathan Wakely
2021-05-07 22:49 ` Jonathan Wakely
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=6f91ec9a-888e-cfc4-8d93-9bf9d563266a@redhat.com \
--to=sbergman@redhat.com \
--cc=jwakely@redhat.com \
--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).