https://bugs.llvm.org/show_bug.cgi?id=45320

            Bug ID: 45320
           Summary: Please ad the -Wno-pmf-conversions gcc extension
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

With -Wno-pmf-conversions gcc compiles

struct foo {
    virtual void func() = 0;
};
void* bar(foo* x) {
    void (foo::*f)() = &foo::func;
    return (void*)(x->*f);
}

Into

        movq    (%rdi), %rax
        movq    (%rax), %rax
        ret

That is, it extracts the pointer to the virtual function. This can be
convenient for debugging tools. In seastar we would like to use it to print the
address of a particular function in scheduled tasks. The advantaged of having
the address of the function instead of the task is that it can be mapped to a
location in the source code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to