Clang error: array of A type is invalid in OpenCL (err_opencl_invalid_type_array)
Jump to navigation
Jump to search
Text | error: array of A type is invalid in OpenCL |
---|---|
Type | Error |
Category | Semantic Issue |
Internal Id | err_opencl_invalid_type_array |
Internal Message | array of %0 type is invalid in OpenCL
|
Regular Expression | (?:error|fatal error)\: array of (.*?) type is invalid in OpenCL
|
First Commit | 2016-02-24 89307aa3e9fc [OpenCL] Add Sema checks for OpenCL 2.0 block |
Description
Example
Flags | -x cl -cl-std=CL1.2
|
|
---|---|---|
Source |
__kernel void f(__global image2d_t i[]) {
// Arrays of image2d_t are invalid
}
| |
Compiler Output |
<source>:1:37: error: array of '__global __read_only image2d_t' type is invalid in OpenCL |
Clang Internals (17.0.6)
Git Commit Message
[OpenCL] Add Sema checks for OpenCL 2.0 block Summary: Add Sema checks for opencl 2.0 new features: Block. This patch is partitioned from http://reviews.llvm.org/D16047 Reviewers: Anastasia Subscribers: pekka.jaaskelainen, cfe-commits Differential Revision: http://reviews.llvm.org/D17436 llvm-svn: 261719
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaType.cpp (line 2691)
/// Build an array type.
///
/// \param T The type of each element in the array.
///
/// \param ASM C99 array size modifier (e.g., '*', 'static').
///
/// \param ArraySize Expression describing the size of the array.
///
/// \param Brackets The range from the opening '[' to the closing ']'.
///
/// \param Entity The name of the entity that involves the array
/// type, if known.
///
/// \returns A suitable array type, if there are no errors. Otherwise,
/// returns a NULL type.
QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity) {
// ...
// OpenCL v2.0 s6.12.5 - Arrays of blocks are not supported.
// OpenCL v2.0 s6.16.13.1 - Arrays of pipe type are not supported.
// OpenCL v2.0 s6.9.b - Arrays of image/sampler type are not supported.
if (getLangOpts().OpenCL) {
// ...
if (ArrType->isBlockPointerType() || ArrType->isPipeType() || ArrType->isSamplerT() || ArrType->isImageType()) {
Diag(Loc, diag::err_opencl_invalid_type_array) << ArrType;
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/SemaOpenCL/invalid-block.cl
- clang/test/SemaOpenCL/invalid-block.cl:65:12: error: array of 'bl2_t' (aka 'int (__generic ^const)(__private int)') type is invalid in OpenCL