-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Prevent implicit conversion from device to queue. (#1292)
Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
- Loading branch information
1 parent
52a63fa
commit 3b6799a
Showing
2 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RUN: %clangxx -fsyntax-only -Xclang -verify %s -Xclang -verify-ignore-unexpected=note,warning | ||
//==-- implicit_conversion_error.cpp - Unintended implicit conversion check --==// | ||
// | ||
// 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() { | ||
cl::sycl::queue q; | ||
cl::sycl::context cxt = q.get_context(); | ||
cl::sycl::device dev = q.get_device(); | ||
|
||
cl::sycl::context cxt2{dev}; | ||
cl::sycl::context cxt3 = dev; // expected-error {{no viable conversion from 'cl::sycl::device' to 'cl::sycl::context'}} | ||
|
||
cl::sycl::queue q2{dev}; | ||
cl::sycl::queue q3 = dev; // expected-error {{no viable conversion from 'cl::sycl::device' to 'cl::sycl::queue'}} | ||
} |