This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] 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.

Tested x86_64-linux, committed to trunk.


Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]