brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · e507489 Raw
49 lines · cpp
1// RUN: %clang_cc1 -fsycl-is-device -triple spir64 -verify -fsyntax-only %s2 3thread_local const int prohobit_ns_scope = 0;4thread_local int prohobit_ns_scope2 = 0;5thread_local const int allow_ns_scope = 0;6 7struct S {8  static const thread_local int prohibit_static_member;9  static thread_local int prohibit_static_member2;10};11 12struct T {13  static const thread_local int allow_static_member;14};15 16void foo() {17  // expected-error@+1{{thread-local storage is not supported for the current target}}18  thread_local const int prohibit_local = 0;19  // expected-error@+1{{thread-local storage is not supported for the current target}}20  thread_local int prohibit_local2;21}22 23void bar() { thread_local int allow_local; }24 25void usage() {26  // expected-note@+1 {{called by}}27  foo();28  // expected-error@+1 {{thread-local storage is not supported for the current target}}29  (void)prohobit_ns_scope;30  // expected-error@+1 {{thread-local storage is not supported for the current target}}31  (void)prohobit_ns_scope2;32  // expected-error@+1 {{thread-local storage is not supported for the current target}}33  (void)S::prohibit_static_member;34  // expected-error@+1 {{thread-local storage is not supported for the current target}}35  (void)S::prohibit_static_member2;36}37 38template <typename name, typename Func>39__attribute__((sycl_kernel))40// expected-note@+2 2{{called by}}41void42kernel_single_task(Func kernelFunc) { kernelFunc(); }43 44int main() {45  // expected-note@+1 2{{called by}}46  kernel_single_task<class fake_kernel>([]() { usage(); });47  return 0;48}49