[cfe-dev] Pointer-to-member does not honor LHS address space

Félix Cloutier via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 11 23:46:33 PST 2017


Hello all,

About a year ago, I found a bug with the interaction of address spaces and C++ pointers to members. Applying a pointer-to-member to a pointer discards the address space of the pointer if it had one. For instance, with this code:

> struct foo {
>     int bar;
> };
> 
> #define AS1 __attribute__((address_space(1)))
> 
> int main()
> {
>     foo AS1* f;
>     int AS1* x = &(f->*(&foo::bar));
> }


Clang says:

> cannot initialize a variable of type '__attribute__((address_space(1))) int *' with an rvalue of type 'int *'


I filed a bug (https://llvm.org/bugs/show_bug.cgi?id=25941 <https://llvm.org/bugs/show_bug.cgi?id=25941>) and even had a patch for it when I found it, but I never followed through. The patch is one single line of code and appears to be still applicable. What are the next steps to get the problem fixed?

Félix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170111/fabb4e92/attachment.html>


More information about the cfe-dev mailing list