@@ -20,24 +20,20 @@ namespace { struct S4 {}; }
2020[[clang::sycl_external]] void func4 (S4) {}
2121
2222// expected-error@+3{{'clang::sycl_external' can only be applied to functions with external linkage}}
23+ namespace { struct S5 {}; }
24+ template <typename > [[clang::sycl_external]] void func5 ();
25+ template <> [[clang::sycl_external]] void func5<S5>() {}
26+
2327namespace { struct S6 {}; }
2428template <typename >
2529[[clang::sycl_external]] void func6 () {}
2630template void func6<S6>();
27- // expected-note@-1{{in instantiation of function template specialization 'func6<(anonymous namespace)::S6>' requested here}}
28-
29- // FIXME: C++23 [temp.expl.spec]p12 states:
30- // ... Similarly, attributes appearing in the declaration of a template
31- // have no effect on an explicit specialization of that template.
32- // Clang currently instantiates and propagates attributes from a function
33- // template to its explicit specializations resulting in the following
34- // spurious error.
35- // expected-error@+3 2{{'clang::sycl_external' can only be applied to functions with external linkage}}
31+
32+ // expected-error@+3{{'clang::sycl_external' can only be applied to functions with external linkage}}
3633namespace { struct S7 {}; }
3734template <typename >
3835[[clang::sycl_external]] void func7 ();
3936template <> void func7<S7>() {}
40- // expected-note@-1{{in instantiation of function template specialization 'func7<(anonymous namespace)::S7>' requested here}}
4137
4238// FIXME: The explicit function template specialization appears to trigger
4339// instantiation of a declaration from the primary template without the
@@ -51,21 +47,17 @@ template<> [[clang::sycl_external]] void func8<S8>() {}
5147// expected-error@-2{{'clang::sycl_external' can only be applied to functions with external linkage}}
5248// expected-note@-3{{previous declaration is here}}
5349
54- // FIXME: The implicit instantiation of func9<S9>() is valid.
5550namespace { struct S9 {}; }
5651struct T9 {
5752 using type = S9;
5853};
59- // expected-error@+2{{'clang::sycl_external' can only be applied to functions with external linkage}}
6054template <typename >
6155[[clang::sycl_external]] void func9 () {}
62- // expected-note@+3{{in instantiation of function template specialization 'func9<(anonymous namespace)::S9>' requested here}}
6356template <typename T>
6457[[clang::sycl_external]] void test_func9 () {
6558 func9<typename T::type>();
6659}
67- // expected-note@+1{{in instantiation of function template specialization 'test_func9<T9>' requested here}}
68- template void test_func9<T9>(); // FIXME: don't diagnose implicit instantiation of func9<S9>().
60+ template void test_func9<T9>();
6961
7062// The first declaration of a SYCL external function is required to have this attribute.
7163// expected-note@+1{{previous declaration is here}}
@@ -79,10 +71,8 @@ void goo();
7971[[clang::sycl_external]] void goo ();
8072void goo () {}
8173
82- // expected-note@+2{{previous definition is here}}
8374// expected-note@+1{{previous declaration is here}}
8475void hoo () {}
85- // expected-warning@+2{{attribute declaration must precede definition}}
8676// expected-warning@+1{{'clang::sycl_external' attribute does not appear on the first declaration}}
8777[[clang::sycl_external]] void hoo ();
8878
0 commit comments