Skip to content

[SYCL] compiler issues an error when std::nullptr_t is used as a kernel name type #247

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

Closed
kbobrovs opened this issue Jun 24, 2019 · 3 comments

Comments

@kbobrovs
Copy link
Contributor

The following test fails to compile:
null_name.cpp.txt

$ clang++ -fsycl null_name.cpp -lOpenCL
In file included from :1:
/tmp/null_name-36241f.h:41:31: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
template <> struct KernelInfo<nullptr_t> {
^~~~~~~~~
std::nullptr_t
/usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0/bits/c++config.h:235:29: note: 'std::nullptr_t' declared here
typedef decltype(nullptr) nullptr_t;
^
1 error generated.

@erichkeane
Copy link
Contributor

@premanandrao , is this one no longer valid?

@premanandrao
Copy link
Contributor

@premanandrao , is this one no longer valid?

I gave this one to @jtmott-intel for the cleanup that @rolandschulz requested.

@jtmott-intel
Copy link
Contributor

Resolved by #1963.

We still issue an error when std::nullptr_t is used as a kernel name, it's just that now we do so intentionally instead of accidentally. Kernel names are expected to be forward declarable, and the C++ standard forbids any name in the std namespace to be forward declared. Therefore, std::nullptr_t -- or std::anything -- may not be used in a kernel name, and if it is, then we emit a diagnostic error, "Kernel name cannot be a type in the std namespace."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants