jvesely added a comment.

In http://reviews.llvm.org/D19932#465784, @yaxunl wrote:

> In http://reviews.llvm.org/D19932#465781, @jvesely wrote:
>
> > In http://reviews.llvm.org/D19932#465763, @cfe-commits wrote:
> >
> > > The returned pointer should point to the same pointee type as the 
> > > argument. Header file cannot guarantee that.
> > >
> > > Sam
> >
> >
> > how come? is there a possibility to have two different types using the same 
> > name?
>
>
> Because the pointee type is arbitrary, you can only define it as
>
>   global void* to_global(void*);
>   
>
> in the header file. Then you could have
>
>   int *a;
>   global double *b = to_global(a);
>   
>
> without diagnostics, but the spec requires that to_global(a) should have 
> global int* type, therefore there should be some diagnostics.


this is not true. as I pointed out earlier, take a look at libclc headers. a 
lot functions are defined for multiple types while maintaining type safety.
there is no problem having TYPE * to_global(TYPE *), for every permissible CLC 
type, declared in headers without any builtin.


Repository:
  rL LLVM

http://reviews.llvm.org/D19932



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to