[PATCH] D52240: Partial Fix for PR#39864

Marshall Clow via Phabricator reviews at reviews.llvm.org
Tue Sep 18 09:37:49 PDT 2018


mclow.lists created this revision.
mclow.lists added reviewers: ldionne, EricWF.

In https://llvm.org/r336132, I broke <string> when compiled with GCC in `-std=c++03`

This fixes part of this, by wrapping the template constraints in an `#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES` block - since these ones are only necessary when using template deduction guides (implicit or explicit)

I'm a bit concerned about whether or not this moves stuff into/out of the dylib (since we instantiate `basic_string` there)


https://reviews.llvm.org/D52240

Files:
  include/string


Index: include/string
===================================================================
--- include/string
+++ include/string
@@ -807,7 +807,9 @@
     basic_string(basic_string&& __str, const allocator_type& __a);
 #endif  // _LIBCPP_CXX03_LANG
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
     template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
+#endif
     _LIBCPP_INLINE_VISIBILITY
     basic_string(const _CharT* __s) {
       _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
@@ -817,7 +819,9 @@
 #   endif
     }
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
     template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
+#endif
         _LIBCPP_INLINE_VISIBILITY
         basic_string(const _CharT* __s, const _Allocator& __a);
 
@@ -828,7 +832,9 @@
     _LIBCPP_INLINE_VISIBILITY
     basic_string(size_type __n, _CharT __c);
 
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
     template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type>
+#endif
         _LIBCPP_INLINE_VISIBILITY
         basic_string(size_type __n, _CharT __c, const _Allocator& __a);
 
@@ -1781,7 +1787,9 @@
 }
 
 template <class _CharT, class _Traits, class _Allocator>
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template <class>
+#endif
 basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
     : __r_(__second_tag(), __a)
 {
@@ -1918,7 +1926,9 @@
 }
 
 template <class _CharT, class _Traits, class _Allocator>
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template <class>
+#endif
 basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
     : __r_(__second_tag(), __a)
 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52240.165991.patch
Type: text/x-patch
Size: 1769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20180918/90bcd386/attachment-0001.bin>


More information about the libcxx-commits mailing list