================
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsycl-is-device -std=c++20 -fsyntax-only -verify -DCPP20 %s
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only be 
applied to functions with external linkage}}
+static void func1() {}
+
+namespace {
+  [[clang::sycl_external]] // expected-error {{'sycl_external' can only be 
applied to functions with external linkage}}
+  void func2() {}
+
+  struct UnnX {};
+}
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only be 
applied to functions with external linkage}}
+  void func4(UnnX) {}
+
----------------
schittir wrote:



> Here is another case. DPC++ does diagnose this one. 
> https://godbolt.org/z/9E9aPn6eq
> 
> ```
> namespace { struct S8 {}; }
> template<typename>
> void func8();
> template<> [[clang::sycl_external]] void func8<S8>() {}
> ```
`template<> [[clang::sycl_external]] void func8<S8>() {} `line triggers a 
"'clang::sycl_external' attribute does not appear on the first declaration" 
diagnostic implemented in this PR



https://github.com/llvm/llvm-project/pull/140282
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to