]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/include/bits/stringfwd.h
Define std::string and related typedefs outside __cxx11 namespace
authorJonathan Wakely <jwakely@redhat.com>
Tue, 9 Oct 2018 13:06:46 +0000 (14:06 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 9 Oct 2018 13:06:46 +0000 (14:06 +0100)
commit33b43b0d8cd2de722d177ef823930500948a7487
treefe52c12f4745d6dc6e912bdf1181fc9c1d0aec2d
parentfe8a86e1f445c4f97c06ddc36ce68ca40627a1cc
Define std::string and related typedefs outside __cxx11 namespace

The typedefs for common specializations of std::__cxx11::basic_string do
not need to be in the std::__cxx11 namespace. Those typedefs are never
used for linkage purposes so don't appear in mangled names, and so don't
need to be distinct from the equivalent typedefs for the COW
std::basic_string specializations. It is OK for the same typedef to
refer to different types in different translation units.

Defining them directly in namespace std improves diagnostics that use
those typedefs. For example:

error: could not convert '1' from 'int' to 'std::__cxx11::string' {aka 'std::__cxx11::basic_string<char>'}

will now be printed as:

error: could not convert '1' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}

The precise type is still shown, but the typedef is not obfuscated with
the inline namespace.

* include/bits/stringfwd.h (string, wstring, u16string, u32string):
Define typedefs outside of __cxx11 inline namespace.
* python/libstdcxx/v6/printers.py (register_type_printers): Also
register printers for typedefs in new location.

From-SVN: r264958
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stringfwd.h
libstdc++-v3/python/libstdcxx/v6/printers.py