[llvm-bugs] [Bug 45320] New: Please ad the -Wno-pmf-conversions gcc extension

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 26 14:45:23 PDT 2020


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: unassignedclangbugs at nondot.org
          Reporter: rafael at espindo.la
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200326/41be9576/attachment.html>


More information about the llvm-bugs mailing list