diff --git a/sycl/include/sycl/detail/defines.hpp b/sycl/include/sycl/detail/defines.hpp index 23df19ce4b284..951d098cceb74 100644 --- a/sycl/include/sycl/detail/defines.hpp +++ b/sycl/include/sycl/detail/defines.hpp @@ -21,7 +21,7 @@ #endif #endif -#if __has_attribute(sycl_special_class) +#if __has_attribute(sycl_special_class) && defined(__SYCL_DEVICE_ONLY__) #define __SYCL_SPECIAL_CLASS __attribute__((sycl_special_class)) #else #define __SYCL_SPECIAL_CLASS