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

            Bug ID: 27011
           Summary: [ms] taking the address of a bound member function to
                    form a pointer to member function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: andrey.kules...@intel.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

!- This problem has been found during a compilation of open source WinMerge
application (http://winmerge.org/). Problem appeared in ChildFrm.cpp 
This affects ms compatibility, gcc also can compile this sample with
"-fpermissive" option. 

It seems that this feature might be added to clang on Linux under
"-fpermissive" option to be compatible with gcc.
But on Windows it might be added by the default to be compatible with msvc. -!

========Environment==========
OS: Win
Language: C++
Version: trunk

========Reproducer===========
struct Base {};
struct Derived : Base {};

typedef void (Base::*PF)(void);

struct S { PF pfn; };

struct A {
       void f() {}
       static void g() {
             static const S s{ (PF)(void (Derived::*)(void))&f };
       }
};

int main(){
       A a;
}

===========Error=============
>>>clang [with any option]:
test.cpp(11,61) :  error: must explicitly qualify name of member function when
taking its address
             static const S s{ (PF)(void (Derived::*)(void))&f };

>>>Intel icc compiler: 
<no diag>

>>> MSVC: 
<no diag>

>>>gcc [default]:
error: ISO C++ forbids taking the address of a bound member function to form a
pointer to member function.  Say ‘&A::f’ [-fpermissive]
                                static const S s{ (PF)(void
(Derived::*)(void))&f };

>>>gcc [with -fpermissive]:
 warning: ISO C++ forbids taking the address of a bound member function to form
a pointer to member function.  Say ‘&A::f’ [-fpermissive]
                                static const S s{ (PF)(void
(Derived::*)(void))&f };


Andrey Kuleshov
======
Software Engineer
Intel Compiler Team

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to