Skip to content

[SYCL] sycl::span declaration tests. #5056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions sycl/test/basic_tests/span.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// RUN: %clangxx -fsycl -c %s

//==--------------- span.cpp - SYCL span test ------------------------------==//
//
// 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
//
//===----------------------------------------------------------------------===//

#include <CL/sycl.hpp>

int main() {
// test the various span declarations, especially unspecialized ones.
// should compile
int arr[]{1, 2, 3, 4};
const int constArr[]{8, 7, 6};
std::vector<int> vec(4);

// unspecialized
sycl::span fromArray{arr};
sycl::span fromConstArray{constArr};
sycl::span fromVec{vec};

// partly specialized
sycl::span<int> fromIntArray{arr};
sycl::span<const int> fromIntConstArray{constArr};
sycl::span<int> fromIntVec{vec};

// fully specialized
// TODO: fix fully specialized span from array declaration support
// sycl::span<int,4> fullSpecArray{arr};
// sycl::span<const int,3> fullSpecConstArray{constArr};
sycl::span<int, 4> fullSpecVecArray{vec};

return 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing EOL