Pointer-to-member does not honor LHS address space

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) 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?


Put it up for review in Phabricator, with a reference to the bug.
For more on phabricator: http://llvm.org/docs/Phabricator.html

You’ll probably be asked to add a test-case so that if someone removes/alters that line, some test(s) will fail. (Using your sampel would probably be fine, just wrapping the usual test-stuff around it - find some similar type of tests somewhere and do suitable copy/paste/modify editing).

Wait for feedback on the review, update as appropriate, repeat until approved.

Once the review is approved, ask someone to commit it (I presume you don’t have permission to commit).