1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -fsycl-is-device -verify %s
4 class [[clang::sycl_special_class
]] class1
{
7 class __attribute__((sycl_special_class
)) class2
{
12 class [[clang::sycl_special_class
]] class3
{
17 class __attribute__((sycl_special_class
)) class4
{
21 struct [[clang::sycl_special_class
]] struct1
{
24 struct __attribute__((sycl_special_class
)) struct2
{
28 class __attribute__((sycl_special_class
)) class5
;
33 struct __attribute__((sycl_special_class
)) struct6
{
35 bool operator==(const struct6
&);
36 struct6
&operator()();
41 // Must have one and only one __init method defined
42 class __attribute__((sycl_special_class
)) class6
{ // expected-error {{types with 'sycl_special_class' attribute must have one and only one '__init' method defined}}
45 class [[clang::sycl_special_class
]] class7
{ // expected-error {{types with 'sycl_special_class' attribute must have one and only one '__init' method defined}}
49 class [[clang::sycl_special_class
]] class8
{ // expected-error {{types with 'sycl_special_class' attribute must have one and only one '__init' method defined}}
55 struct __attribute__((sycl_special_class
)) struct3
;
56 struct struct3
{}; // expected-error {{types with 'sycl_special_class' attribute must have one and only one '__init' method defined}}
58 // expected-error@+1{{'sycl_special_class' attribute must have one and only one '__init' method defined}}
59 struct __attribute__((sycl_special_class
)) struct7
{
61 bool operator==(const struct7
&);
62 struct7
&operator()();
67 [[clang::sycl_special_class
]] int var1
= 0; // expected-warning {{'sycl_special_class' attribute only applies to classes}}
68 __attribute__((sycl_special_class
)) int var2
= 0; // expected-warning {{'sycl_special_class' attribute only applies to classes}}
70 [[clang::sycl_special_class
]] void foo1(); // expected-warning {{'sycl_special_class' attribute only applies to classes}}
71 __attribute__((sycl_special_class
)) void foo2(); // expected-warning {{'sycl_special_class' attribute only applies to classes}}
73 // Attribute takes no arguments
74 class [[clang::sycl_special_class(1)]] class9
{}; // expected-error {{'sycl_special_class' attribute takes no arguments}}
75 class __attribute__((sycl_special_class(1))) class10
{}; // expected-error {{'sycl_special_class' attribute takes no arguments}}
77 // __init method must be defined inside the CXXRecordDecl.
78 class [[clang::sycl_special_class
]] class11
{ // expected-error {{types with 'sycl_special_class' attribute must have one and only one '__init' method defined}}
81 void class11::__init(){}
83 class __attribute__((sycl_special_class
)) class12
{ // expected-error {{types with 'sycl_special_class' attribute must have one and only one '__init' method defined}}
86 void class12::__init(){}
88 struct [[clang::sycl_special_class
]] struct4
{ // expected-error {{types with 'sycl_special_class' attribute must have one and only one '__init' method defined}}
91 void struct4::__init(){}
93 struct __attribute__((sycl_special_class
)) struct5
{ // expected-error {{types with 'sycl_special_class' attribute must have one and only one '__init' method defined}}
96 void struct5::__init(){}