1 // RUN: %clang_cc1 -fsyntax-only %s -std=c++11 -verify
3 // This is a test for a hack in Clang that works around an issue with libc++'s
4 // <valarray> implementation. The <valarray> header contains explicit
5 // instantiations of functions that it declared with the internal_linkage
6 // attribute, which are ill-formed by [temp.explicit]p13 (and meaningless).
10 #pragma GCC system_header
12 using size_t = __SIZE_TYPE__
;
13 template<typename T
> struct valarray
{
14 __attribute__((internal_linkage
)) valarray(size_t) {}
15 __attribute__((internal_linkage
)) ~valarray() {}
18 extern template valarray
<size_t>::valarray(size_t);
19 extern template valarray
<size_t>::~valarray();
25 #include "libcxx_valarray_hack.cpp"
27 template<typename T
> struct foo
{
28 __attribute__((internal_linkage
)) void x() {};
30 extern template void foo
<int>::x(); // expected-error {{explicit instantiation declaration of 'x' with internal linkage}}