Files
clang-p2996/clang/test/Parser/opencl-cl20.cl
Sven van Haastregt 2ca6ba1045 [OpenCL] Restrict various keywords in OpenCL C++ mode
Restrict the following keywords in the OpenCL C++ language mode,
according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification.

 - dynamic_cast
 - typeid
 - register (already restricted in OpenCL C, update the diagnostic)
 - thread_local
 - exceptions (try/catch/throw)
 - access qualifiers read_only, write_only, read_write

Support the `__global`, `__local`, `__constant`, `__private`, and
`__generic` keywords in OpenCL C++.  Leave the unprefixed address
space qualifiers such as global available, i.e., do not mark them as
reserved keywords in OpenCL C++.  libclcxx provides explicit address
space pointer classes such as `global_ptr` and `global<T>` that are
implemented using the `__`-prefixed qualifiers.

Differential Revision: https://reviews.llvm.org/D46022

llvm-svn: 331874
2018-05-09 13:16:17 +00:00

27 lines
954 B
Common Lisp

// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -DCL20
#ifdef CL20
// expected-no-diagnostics
#endif
__generic int * __generic_test(__generic int *arg) {
__generic int *var;
return var;
}
#ifndef CL20
// expected-error@-5 {{OpenCL C version 1.0 does not support the '__generic' type qualifier}}
// expected-error@-6 {{OpenCL C version 1.0 does not support the '__generic' type qualifier}}
// expected-error@-6 {{OpenCL C version 1.0 does not support the '__generic' type qualifier}}
#endif
generic int * generic_test(generic int *arg) {
generic int *var;
return var;
}
#ifndef CL20
// expected-error@-5 {{OpenCL C version 1.0 does not support the 'generic' type qualifier}}
// expected-error@-6 {{OpenCL C version 1.0 does not support the 'generic' type qualifier}}
// expected-error@-6 {{OpenCL C version 1.0 does not support the 'generic' type qualifier}}
#endif