@@ -740,5 +740,51 @@ int main() {
740740 }
741741 }
742742
743+ // Accessor common property interface
744+ {
745+ using namespace sycl ::ext::oneapi;
746+ int data[1 ] = {0 };
747+
748+ // host accessor
749+ try {
750+ sycl::buffer<int , 1 > buf_data (data, sycl::range<1 >(1 ),
751+ {sycl::property::buffer::use_host_ptr ()});
752+ accessor_property_list PL{no_alias, no_offset, sycl::no_init};
753+ sycl::accessor acc_1 (buf_data, PL);
754+ static_assert (acc_1.has_property <property::no_alias>());
755+ static_assert (acc_1.has_property <property::no_offset>());
756+ assert (acc_1.has_property <sycl::property::no_init>());
757+
758+ static_assert (acc_1.get_property <property::no_alias>() == no_alias);
759+ static_assert (acc_1.get_property <property::no_offset>() == no_offset);
760+ assert (acc_1.get_property <sycl::property::no_init>() == sycl::no_init);
761+ } catch (sycl::exception e) {
762+ std::cout << " SYCL exception caught: " << e.what () << std::endl;
763+ }
764+
765+ // base accessor
766+ try {
767+ sycl::buffer<int , 1 > buf_data (data, sycl::range<1 >(1 ),
768+ {sycl::property::buffer::use_host_ptr ()});
769+ sycl::queue q;
770+ accessor_property_list PL{no_alias, no_offset, sycl::no_init};
771+
772+ q.submit ([&](sycl::handler &cgh) {
773+ sycl::accessor acc_1 (buf_data, PL);
774+ static_assert (acc_1.has_property <property::no_alias>());
775+ static_assert (acc_1.has_property <property::no_offset>());
776+ assert (acc_1.has_property <sycl::property::no_init>());
777+
778+ static_assert (acc_1.get_property <property::no_alias>() == no_alias);
779+ static_assert (acc_1.get_property <property::no_offset>() == no_offset);
780+ assert (acc_1.get_property <sycl::property::no_init>() == sycl::no_init);
781+ });
782+ q.wait ();
783+ } catch (sycl::exception e) {
784+ std::cout << " SYCL exception caught: " << e.what () << std::endl;
785+ }
786+ }
787+ std::cout << " Test passed" << std::endl;
788+
743789 std::cout << " Test passed" << std::endl;
744790}
0 commit comments