]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Fix constraints for rvalue stream insertion/extraction
authorJonathan Wakely <jwakely@redhat.com>
Thu, 6 May 2021 18:14:42 +0000 (19:14 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 7 May 2021 22:50:04 +0000 (23:50 +0100)
commit768feed93231fc75997e1bc0c53a8c8f108ecbc0
treebc8026474ce04277a6162b3cf41e422c34f07c9d
parent8482ed658ca77bfd7fc119cd62afd5b70a024500
libstdc++: Fix constraints for rvalue stream insertion/extraction

The __rval_streamable() function was an attempt to test for
convertibility cheaply and without confusing diagnostics. It doesn't
work with Clang though, and is probably ill-formed.

Replace that helper function with a check for derivation from ios_base,
and use that in the alias templates __rvalue_stream_insertion_t and
__rvalue_stream_extraction_t. Use concepts for the constraints when
available.

libstdc++-v3/ChangeLog:

* include/std/istream (__rvalue_stream_extraction_t): Replace
use of __rval_streamable.
* include/std/ostream (__rvalue_stream_insertion_t): Likewise.
(__rval_streamable): Remove.
(_Require_derived_from_ios_base, __derived_from_ios_base): New
helper for checking constraints.
* testsuite/27_io/basic_istream/extractors_other/char/4.cc: Fix
reference to the wrong subclause of the standard.
* testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/6.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/99692.cc:
New test.
* testsuite/27_io/filesystem/path/io/dr2989.cc: Adjust pruned
errors.

(cherry picked from commit a87ceadf17b4a899f3e74e2da8b6b209461d2742)
libstdc++-v3/include/std/istream
libstdc++-v3/include/std/ostream
libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/4.cc
libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc
libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc
libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/99692.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc
libstdc++-v3/testsuite/27_io/filesystem/path/io/dr2989.cc
This page took 0.056287 seconds and 5 git commands to generate.