It is disallowed in OpenCL C to declare static kernel functions and
C++ for OpenCL is expected to inherit such behaviour. Error is now
correctly reported in C++ for OpenCL when declaring a static kernel
function.
Details
Diff Detail
Event Timeline
clang/lib/Sema/SemaDecl.cpp | ||
---|---|---|
9972 | I wonder though if we should just drop a version check here completely. I don't think we can allow this in the earlier OpenCL versions. The reason why it doesn't apply to earlier versions is that static/extern wasn't allowed at all so presumably frontend would reject such a case earlier. I think the extra check is not doing anything useful here, but only adds extra code to read and maintain. |
clang/lib/Sema/SemaDecl.cpp | ||
---|---|---|
9972 | That is correct. If static or extern is used in OpenCL C 1.0, diagnostic err_opencl_unknown_type_specifier is displayed before control flow reaches this part of code. And so removing the check here doesn't seem to change the compiler behaviour. |
I wonder though if we should just drop a version check here completely.
I don't think we can allow this in the earlier OpenCL versions. The reason why it doesn't apply to earlier versions is that static/extern wasn't allowed at all so presumably frontend would reject such a case earlier.
I think the extra check is not doing anything useful here, but only adds extra code to read and maintain.