[llvm-bugs] [Bug 27011] New: [ms] taking the address of a bound member function to form a pointer to member function
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Mar 21 04:02:09 PDT 2016
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: unassignedclangbugs at nondot.org
Reporter: andrey.kuleshov at intel.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160321/3d7e6d98/attachment.html>
More information about the llvm-bugs
mailing list