PR libstdc++/87061 remove pmr type aliases for COW strings
authorJonathan Wakely <jwakely@redhat.com>
Wed, 22 Aug 2018 22:54:33 +0000 (23:54 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 22 Aug 2018 22:54:33 +0000 (23:54 +0100)
The pmr aliases for basic_string and match_results are incompatible with
the gcc4-compatible ABI because the Copy-On-Write basic_string class
doesn't support C++11 allocators.

PR libstdc++/87061
* include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::match_results, experimental::pmr::cmatch)
(experimental::pmr::smatch, experimental::pmr::wcmatch)
(experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
because COW strings don't support C++11 allocator model.
* include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::basic_string, experimental::pmr::string)
(experimental::pmr::u16string, experimental::pmr::u32string)
(experimental::pmr::wstring): Likewise.
* include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results)
(pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise.
* include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string)
(pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise.
* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require
cxx11-abi.
* testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.

From-SVN: r263791

libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/regex
libstdc++-v3/include/experimental/string
libstdc++-v3/include/std/regex
libstdc++-v3/include/std/string
libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc
libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc

index dfe3a52443a10e23e74713fb235cca8f9445faec..e703ffb514363af551970f2646a1831aa027a98c 100644 (file)
@@ -1,5 +1,23 @@
 2018-08-22  Jonathan Wakely  <jwakely@redhat.com>
 
+       PR libstdc++/87061
+       * include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
+       (experimental::pmr::match_results, experimental::pmr::cmatch)
+       (experimental::pmr::smatch, experimental::pmr::wcmatch)
+       (experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
+       because COW strings don't support C++11 allocator model.
+       * include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
+       (experimental::pmr::basic_string, experimental::pmr::string)
+       (experimental::pmr::u16string, experimental::pmr::u32string)
+       (experimental::pmr::wstring): Likewise.
+       * include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results)
+       (pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise.
+       * include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string)
+       (pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise.
+       * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require
+       cxx11-abi.
+       * testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.
+
        PR libstdc++/78448
        * include/bits/deque.tcc (deque::_M_range_initialize): Use
        _S_check_init_len to check size.
index eb2af151245f2e27ca235c501d7823d215445e03..633b396b312ee08699d2fafbfaef809c73bb6dd0 100644 (file)
@@ -44,6 +44,7 @@ namespace experimental
 {
 inline namespace fundamentals_v2
 {
+#if _GLIBCXX_USE_CXX11_ABI
 namespace pmr
 {
   template<typename _BidirectionalIterator>
@@ -57,7 +58,7 @@ namespace pmr
   typedef match_results<wstring::const_iterator> wsmatch;
 
 } // namespace pmr
-
+#endif
 } // namespace fundamentals_v2
 } // namespace experimental
 _GLIBCXX_END_NAMESPACE_VERSION
index f101255d6417a422046d1c849b78a06d7a9653b4..5a96bf78d7331afb72fc559c2827c6f8a22c4f67 100644 (file)
@@ -62,6 +62,7 @@ inline namespace fundamentals_v2
                   __cont.end());
     }
 
+#if _GLIBCXX_USE_CXX11_ABI
   namespace pmr
   {
     // basic_string using polymorphic allocator in namespace pmr
@@ -77,6 +78,7 @@ inline namespace fundamentals_v2
     typedef basic_string<wchar_t> wstring;
 
   } // namespace pmr
+#endif
 } // namespace fundamentals_v2
 } // namespace experimental
 
index f0dfa3f68ab9b2c449c4d7528ca62b26d60d5e94..fd15565835300b17cd037a45172d07ead3e50c49 100644 (file)
@@ -62,7 +62,7 @@
 #include <bits/regex.h>
 #include <bits/regex_executor.h>
 
-#if __cplusplus >= 201703L
+#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI
 #include <memory_resource>
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index d3cc03aa179a17cfcf8c23664c0b6cb40a5fb395..dd60df2ba6e6284d9fc1592a81cdd66a1b3b97c7 100644 (file)
@@ -52,7 +52,7 @@
 #include <bits/basic_string.h>
 #include <bits/basic_string.tcc>
 
-#if __cplusplus >= 201703L
+#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
index d20fc42901e93f0e4552ce6796d8f5fea4e1bf46..23956673792f70ef99497343e64cd349d62422d2 100644 (file)
@@ -17,6 +17,7 @@
 
 // { dg-options "-std=gnu++17" }
 // { dg-do compile { target c++17 } }
+// { dg-require-effective-target cxx11-abi }
 
 #include <string>
 #include <memory_resource>
index 23aef39caf32441686d2d0ac58770c78a26dfc53..d97fcfeb75eb2c79563388407b7aa230cd457c41 100644 (file)
@@ -17,6 +17,7 @@
 
 // { dg-options "-std=gnu++17" }
 // { dg-do compile { target c++17 } }
+// { dg-require-effective-target cxx11-abi }
 
 #include <regex>
 #include <memory_resource>