================ @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s + +// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}} +[[clang::sycl_external]] int a; + + +// expected-error@+2{{'clang::sycl_external' attribute only applies to functions}} +struct s { +[[clang::sycl_external]] int b; +}; + +// expected-error@+1{{'clang::sycl_external' attribute takes no arguments}} +[[clang::sycl_external(3)]] void bar() {} + +// FIXME: The first declaration of a function is required to have the attribute. +// The attribute may be optionally present on subsequent declarations +int foo(int c); + +[[clang::sycl_external]] void foo(); ---------------- tahonermann wrote:
I think those are useful to ensure that a diagnostic of some kind is issued. Ideally, I think the diagnostic would be something along the lines of "does not take an argument" since there is no defined argument syntax. I don't think it is worth trying to do better than the "expected expression" error though. The fact that some code some where is trying to parse arguments here is a separate and out-of-scope issue as far as I'm concerned. 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