Files
gcc/libstdc++-v3/config
Tomasz Kamiński 395e5cef29 libstdc++: Export explicit instantiations for C++20 members of std::string
The C++20 standard added new starts_with and ends_with members to
std::basic_string, which were not previously instantiated in the library.
This meant that the extern template declarations had to be disabled for
C++20 mode. With this patch the new members are instantiated in the
library and so the explicit instantiation declarations can be used for
C++20.

Furthermore, basic_string default constructor is now constrained with
is_default_constructible_v<_Alloc> constrains, that is included in
mangled name, so we also need to instantiate and export it.

The new members added by C++23 are still not exported, and so the
explicit instantiation declarations are still disabled for C++23.

libstdc++-v3/ChangeLog:

	* config/abi/pre/gnu.ver (GLIBCXX_3.4): Make string exports
	less greedy.
	(GLIBCXX_3.4.35): Export basic_string default constructor and
	starts_with and ends_with members.
	* include/bits/basic_string.h: Update __cpluplus checks for C++20.
	* include/bits/cow_string.h: Likewise.
	* include/bits/basic_string.tcc: Declare explicit instantiations
	for C++20 as well as earlier dialects.
	* src/c++20/Makefile.am: Add cow-string-inst.cc and
	string-inst.cc source files.
	* src/c++20/Makefile.in: Regenerate.
	* src/c++20/string-inst.cc: New file defining explicit
	instantiations for basic_string default constructor and starts_with,
	ends_with methods added in C++20
	* src/c++20/cow-string-inst.cc: Version of above for cow-stings.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-07 19:25:27 +02:00
..
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00