aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaSYCL/sycl-external-attr-appertainment.cpp
blob: d06c9c9d5358084de89fde23d219c0278669dc6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -std=c++17 -verify %s
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -std=c++17 -verify %s
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -std=c++20 -verify %s
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -std=c++20 -verify %s
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -std=c++23 -verify %s
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -std=c++23 -verify %s

// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
[[clang::sycl_external]] int bad1;


// expected-error@+2{{'clang::sycl_external' attribute only applies to functions}}
struct s {
[[clang::sycl_external]] int bad2;
};

// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
namespace [[clang::sycl_external]] bad3 {}

// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
struct [[clang::sycl_external]]  bad4;

// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
enum [[clang::sycl_external]] bad5 {};

// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
int bad6(void (fp [[clang::sycl_external]])());

// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
[[clang::sycl_external]];

#if __cplusplus >= 202002L
// expected-error@+2{{'clang::sycl_external' attribute only applies to functions}}
template<typename>
concept bad8 [[clang::sycl_external]] = true;
#endif