Remove incorrect explicit instantiation declarations for valarray

libc++ ABI v1 provides three valarray symbols as part of the shared library:

valarray<size_t>::valarray(size_t)
valarray<size_t>::~valarray()
valarray<size_t>::resize(size_t, size_t)

The first two of these are intended to be removed in V2 of the ABI: they're
attributed _LIBCPP_HIDE_FROM_ABI_AFTER_V1, and  it appears that the intention
is that these symbols from the library are not used even when building using
the V1 ABI. However, there are explicit instantiation declarations for all
three symbols in the header, which are not correct as we do not intend to find
an instantiation of these functions that is provided elsewhere.

(A recent change to clang to properly diagnose explicit instantiation
declarations of internal linkage functions -- required by [temp.explicit]p13 --
had to be rolled back because it diagnosed these explicit instantiations.)

Remove the explicit instantiation declarations, and remove the explicit
instantiation definitions for V2 of the libc++ ABI onwards.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359243 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/valarray b/include/valarray
index 1c4875e..8f6221a 100644
--- a/include/valarray
+++ b/include/valarray
@@ -1059,8 +1059,6 @@
     valarray& __assign_range(const value_type* __f, const value_type* __l);
 };
 
-_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
-_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
 
 template <class _Op, class _Tp>
diff --git a/lib/abi/x86_64-apple-darwin.v2.abilist b/lib/abi/x86_64-apple-darwin.v2.abilist
index 6de64ef..87258c5 100644
--- a/lib/abi/x86_64-apple-darwin.v2.abilist
+++ b/lib/abi/x86_64-apple-darwin.v2.abilist
@@ -1380,10 +1380,6 @@
 {'is_defined': True, 'name': '__ZNSt3__28time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE', 'size': 0, 'type': 'OBJECT'}
 {'is_defined': True, 'name': '__ZNSt3__28time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE', 'size': 0, 'type': 'OBJECT'}
 {'is_defined': True, 'name': '__ZNSt3__28valarrayImE6resizeEmm', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImEC1Em', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImEC2Em', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImED1Ev', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImED2Ev', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE17__stage2_int_loopEciPcRS2_RjcRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSD_PKc', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE17__stage2_int_prepERNS_8ios_baseERc', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE19__stage2_float_loopEcRbRcPcRS4_ccRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSE_RjS4_', 'type': 'FUNC'}
diff --git a/src/valarray.cpp b/src/valarray.cpp
index 893de05..7bf0b41 100644
--- a/src/valarray.cpp
+++ b/src/valarray.cpp
@@ -10,8 +10,12 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+// These two symbols are part of the v1 ABI but not part of the >=v2 ABI.
+#if _LIBCPP_ABI_VERSION == 1
 template valarray<size_t>::valarray(size_t);
 template valarray<size_t>::~valarray();
+#endif
+
 template void valarray<size_t>::resize(size_t, size_t);
 
 void