From 506a09ba0fd11f0cf302cda3d84b0e1ec3cfee97 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 20 Nov 2017 20:23:27 +0000 Subject: Fix std::string::data() symbol during library build. The non-const data() member of std::string is only exposed in C++17 and beyond. However std::string is externally instantiated and so the member function needs to be exposed to be externally instantiated. On Linux and OS X this shouldn't cause a problem, because _LIBCPP_INLINE_VISIBILITY ensures the symbol is always inlined. However on Windows, the symbol gets marked dllimport, but there is no definition to import, causing link errors. llvm-svn: 318690 --- libcxx/include/string | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libcxx/include/string') diff --git a/libcxx/include/string b/libcxx/include/string index 81c242ed6e9..e7142b2b28e 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -1128,7 +1128,7 @@ public: const value_type* c_str() const _NOEXCEPT {return data();} _LIBCPP_INLINE_VISIBILITY const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY) _LIBCPP_INLINE_VISIBILITY value_type* data() _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());} #endif -- cgit v1.2.3