diff --git a/sycl/include/CL/sycl/intel/sub_group_host.hpp b/sycl/include/CL/sycl/intel/sub_group_host.hpp index d6fade163b117..16d9514fa4333 100644 --- a/sycl/include/CL/sycl/intel/sub_group_host.hpp +++ b/sycl/include/CL/sycl/intel/sub_group_host.hpp @@ -136,7 +136,7 @@ struct sub_group { } template - void store(multi_ptr dst, T &x) const { + void store(multi_ptr dst, const T &x) const { throw runtime_error("Subgroups are not supported on host device. "); } diff --git a/sycl/test/regression/sub-group-store-const-ref.cpp b/sycl/test/regression/sub-group-store-const-ref.cpp new file mode 100644 index 0000000000000..991f56f30a130 --- /dev/null +++ b/sycl/test/regression/sub-group-store-const-ref.cpp @@ -0,0 +1,16 @@ +// RUN: %clangxx -I %sycl_include -fsyntax-only -Xclang -verify %s +// expected-no-diagnostics +// +//==-- sub-group-store-const-ref.cpp ---------------------------------------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// This test checks that sub_group::store supports const reference. +//===----------------------------------------------------------------------===// +#include +using namespace sycl; + +void test(intel::sub_group sg, global_ptr ptr) { sg.store(ptr, 1); }