<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 --- - Inconsistent error message for unqualifed address of member"
href="https://llvm.org/bugs/show_bug.cgi?id=31821">31821</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Inconsistent error message for unqualifed address of member
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tdelisle@uwaterloo.ca
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>When given the following code, clang generates an error and proposes a fix to
the given error :
-----------------------------------------------------------------------------------------
class parent { protected:
virtual void foo() = 0;
};
template<typename T> class child : public parent {
void (parent::*foo_ptr)() = &foo;
};
-----------------------------------------------------------------------------------------
$ clang private.cpp -std=c++11
private.cpp:7:30: error: must explicitly qualify name of member function
when taking its address
void (parent::*foo_ptr)() = &foo;
^~~~
parent::
1 error generated.
Updating the code according to the error message still fails :
-----------------------------------------------------------------------------------------
class parent { protected:
virtual void foo() = 0;
};
template<typename T> class child : public parent {
void (parent::*foo_ptr)() = &parent::foo;
};
-----------------------------------------------------------------------------------------
$ clang private.cpp -std=c++11
private.cpp:6:39: error: 'foo' is a protected member of 'parent'
void (parent::*foo_ptr)() = &parent::foo;
^
private.cpp:2:15: note: must name member using the type of the current
context 'child<T>'
virtual void foo() = 0;
^
1 error generated.
The error messages should be consistent and propose fixes that will not
generate more errors.</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>