<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [ms] taking the address of a bound member function to form a pointer to member function"
href="https://llvm.org/bugs/show_bug.cgi?id=27011">27011</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ms] taking the address of a bound member function to form a pointer to member function
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>andrey.kuleshov@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>!- This problem has been found during a compilation of open source WinMerge
application (<a href="http://winmerge.org/">http://winmerge.org/</a>). 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=============
<span class="quote">>>>clang [with any option]:</span >
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 };
<span class="quote">>>>Intel icc compiler: </span >
<no diag>
<span class="quote">>>> MSVC: </span >
<no diag>
<span class="quote">>>>gcc [default]:</span >
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 };
<span class="quote">>>>gcc [with -fpermissive]:</span >
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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>