public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3867] libstdc++: Implement LWG 3706 for COW strings
@ 2020-10-14 11:53 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-10-14 11:53 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:dc38e255242192303ae463a913c060b426eb06c0

commit r11-3867-gdc38e255242192303ae463a913c060b426eb06c0
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Oct 14 11:52:26 2020 +0100

    libstdc++: Implement LWG 3706 for COW strings
    
    The basic_string deduction guides are defined for the old ABI, but the
    tests are currently disabled. This is because a single case fails when
    using the old ABI, which is just because LWG 3706 isn't implemented for
    the old ABI. That can be done easily, and the tests can be enabled.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
            (basic_string(const _CharT*, const _Alloc&)): Constrain to
            require an allocator-like type to fix CTAD ambiguity (LWG 3706).
            * testsuite/21_strings/basic_string/cons/char/deduction.cc:
            Remove dg-skip-if.
            * testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
            Likewise.

Diff:
---
 libstdc++-v3/include/bits/basic_string.h                           | 7 +++++++
 .../testsuite/21_strings/basic_string/cons/char/deduction.cc       | 1 -
 .../testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc    | 1 -
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index a9fe09f2069..4b3722bdbf1 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -3612,12 +3612,19 @@ _GLIBCXX_END_NAMESPACE_CXX11
        */
       basic_string(const _CharT* __s, size_type __n,
 		   const _Alloc& __a = _Alloc());
+
       /**
        *  @brief  Construct string as copy of a C string.
        *  @param  __s  Source C string.
        *  @param  __a  Allocator to use (default is default allocator).
        */
+#if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 3076. basic_string CTAD ambiguity
+      template<typename = _RequireAllocator<_Alloc>>
+#endif
       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
+
       /**
        *  @brief  Construct string as multiple characters.
        *  @param  __n  Number of characters.
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc
index 6484ed43453..d05c4b776c3 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc
@@ -17,7 +17,6 @@
 
 // { dg-options "-std=gnu++17" }
 // { dg-do compile { target c++17 } }
-// { dg-xfail-if "COW string missing deduction guides" { ! cxx11-abi } }
 
 #include <string>
 #include <testsuite_iterators.h>
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc
index 373b2b24bdd..1773be28e37 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc
@@ -17,7 +17,6 @@
 
 // { dg-options "-std=gnu++17" }
 // { dg-do compile { target c++17 } }
-// { dg-xfail-if "COW string missing deduction guides" { ! cxx11-abi } }
 
 #include <string>
 #include <testsuite_iterators.h>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-14 11:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 11:53 [gcc r11-3867] libstdc++: Implement LWG 3706 for COW strings Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).