fb8b3e2993
The basic_string_view::pointer and basic_string_view::reference typedefs are supposed to refer to the non-const value type. In previous standards having traits_type::char_type different to value_type was simply undefined, but in the C++2a draft it's ill-formed, as changed by P1148R0. For std::basic_string and iostreams we might want to only enforce this conditionally for __cplusplus > 201703L but for std::basic_string_view we don't have backwards compatibility concerns. Also add assertions to verify the _CharT argument is a "char-like" type (non-array, trivial, standard layout type). Also remove the non-standard basic_string_view::_M_check and basic_string_view::_M_limit member functions, replacing them with non-member functions that will still exist even if basic_string_view is specialized by the program. * include/experimental/string_view (basic_string_view::pointer) (basic_string_view::reference): Fix to refer to non-const value_type. * include/bits/basic_string.h (basic_string): Use __sv_check and __sv_limit instead of basic_string_view::_M_check and basic_string_view::_M_limit. * include/std/string_view (__sv_check, __sv_limit): New helper functions to replace basic_string_view::_M_check and basic_string_view::_M_limit. (basic_string_view): Add static assertions to enforce ill-formed requirement for traits_type::char_type from P1148R0, and to enforce required properties of char-like types. (basic_string_view::pointer, basic_string_view::reference): Fix to refer to non-const value_type. (basic_string_view::operator[], basic_string_view::at) (basic_string_view::front, basic_string_view::back) (basic_string_view::data): Use const_reference and const_pointer typedefs for return types. (basic_string_view::_M_check, basic_string_view::_M_limit): Remove. (hash<wstring_view>): Fix argument_type typedef. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/ char/1.cc: Fix expected return type of basic_string_view::data(). * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/ wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/ char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/ wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/traits_neg.cc: New test. * testsuite/21_strings/basic_string_view/requirements/typedefs.cc: Check reference and pointer typedefs. * testsuite/experimental/string_view/requirements/typedefs.cc: Likewise. * testsuite/experimental/string_view/modifiers/remove_prefix/char/1.cc: Fix expected return type of basic_string_view::data(). * testsuite/experimental/string_view/modifiers/remove_prefix/wchar_t/ 1.cc: Likewise. * testsuite/experimental/string_view/modifiers/remove_suffix/char/1.cc: Likewise. * testsuite/experimental/string_view/modifiers/remove_suffix/wchar_t/ 1.cc: Likewise. From-SVN: r270548 |
||
---|---|---|
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.