[libcxx-commits] [libcxx] r366567 - [libc++] Fix link error with _LIBCPP_HIDE_FROM_ABI_PER_TU and std::string
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 19 04:52:55 PDT 2019
Author: ldionne
Date: Fri Jul 19 04:52:55 2019
New Revision: 366567
URL: http://llvm.org/viewvc/llvm-project?rev=366567&view=rev
Log:
[libc++] Fix link error with _LIBCPP_HIDE_FROM_ABI_PER_TU and std::string
Summary:
This is effectively a revert of r344616, which was a partial fix for
PR38964 (compilation of <string> with GCC in C++03 mode). However, that
configuration is explicitly not supported anymore and that partial fix
breaks compilation with Clang when per-TU insulation is provided.
PR42676
rdar://52899715
Reviewers: mclow.lists, EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D64941
Added:
libcxx/trunk/test/libcxx/strings/basic.string/PR42676.sh.cpp
Modified:
libcxx/trunk/include/string
Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=366567&r1=366566&r2=366567&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Fri Jul 19 04:52:55 2019
@@ -812,9 +812,7 @@ public:
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");
@@ -824,9 +822,7 @@ public:
# 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);
@@ -837,9 +833,7 @@ public:
_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);
@@ -1800,9 +1794,7 @@ basic_string<_CharT, _Traits, _Allocator
}
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)
{
@@ -1939,9 +1931,7 @@ basic_string<_CharT, _Traits, _Allocator
}
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)
{
Added: libcxx/trunk/test/libcxx/strings/basic.string/PR42676.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/strings/basic.string/PR42676.sh.cpp?rev=366567&view=auto
==============================================================================
--- libcxx/trunk/test/libcxx/strings/basic.string/PR42676.sh.cpp (added)
+++ libcxx/trunk/test/libcxx/strings/basic.string/PR42676.sh.cpp Fri Jul 19 04:52:55 2019
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Regression test for PR42676.
+
+// RUN: %cxx %flags %s -o %t.exe %compile_flags -D_LIBCPP_HIDE_FROM_ABI_PER_TU
+// RUN: %t.exe
+
+#include <memory>
+#include <string>
+
+int main() {
+ std::string s1(10u, '-', std::allocator<char>()); (void)s1;
+ std::string s2("hello", std::allocator<char>()); (void)s2;
+ std::string s3("hello"); (void)s3;
+}
More information about the libcxx-commits
mailing list