================
@@ -113,6 +113,31 @@ class D {
// expected-error@+1{{'clang::sycl_external' cannot be applied to an
explicitly deleted function}}
[[clang::sycl_external]] void del() = delete;
+// SYCL device code does not support variadic functions.
+// expected-warning@+1{{'clang::sycl_external' attribute ignored; a variadic
function cannot be called from device code}}
+[[clang::sycl_external]] void var(int, ...) {}
+
+// expected-warning@+1{{'clang::sycl_external' attribute ignored; a variadic
function cannot be called from device code}}
+[[clang::sycl_external]] void vardecl(int, ...);
+
+// expected-warning@+1{{'clang::sycl_external' attribute ignored; a variadic
function cannot be called from device code}}
+[[clang::sycl_external]] void varredecl(int, ...);
+// expected-warning@+1{{'clang::sycl_external' attribute ignored; a variadic
function cannot be called from device code}}
+[[clang::sycl_external]] void varredecl(int, ...) {}
+
+// expected-warning@+2{{'clang::sycl_external' attribute ignored; a variadic
function cannot be called from device code}}
+class E {
+ [[clang::sycl_external]] void mvar(int, ...) {}
+};
+
+template<typename... Ts>
+[[clang::sycl_external]] void pack(Ts...) {}
+template void pack(int);
+
+// expected-warning@+2{{'clang::sycl_external' attribute ignored; a variadic
function cannot be called from device code}}
+template<typename T>
+[[clang::sycl_external]] void tvar(T, ...) {}
----------------
tahonermann wrote:
That's good that the diagnostic is issued for the primary template. I'm curious
whether an additional diagnostic is issued if the template is (implicitly or
explicitly) instantiated; that seems worth validating too.
```suggestion
// expected-warning@+2{{'clang::sycl_external' attribute ignored; a variadic
function cannot be called from device code}}
template<typename T>
[[clang::sycl_external]] void tvar(T, ...) {}
template void tvar(int, ...);
```
https://github.com/llvm/llvm-project/pull/216393
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits