[cfe-dev] issues about assigning string literal to __constant char* in OpenCL
Liu, Yaxun (Sam)
Yaxun.Liu at amd.com
Tue Apr 16 10:42:48 PDT 2013
I was trying to compile some simple OpenCL source with clang:
__constant char* __constant a = "hello"; // <----- error in line 1
int myprintf(__constant char * restrict format, ...);
void foo() {
myprintf("%d\n", 5); // <------------ error in line 6
}
Clang emits error msg:
1:18: error: initializing '__constant char *' with an expression of type 'char *' changes address space of pointer
:6:12: error: passing 'char *' to parameter of type '__constant char *' changes address space of pointer
Is this a bug? Otherwise how do I initialize a __constant char* __constant? Thanks.
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130416/34eab9e0/attachment.html>
More information about the cfe-dev
mailing list