[llvm-bugs] [Bug 31821] New: Inconsistent error message for unqualifed address of member
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 31 09:53:59 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31821
Bug ID: 31821
Summary: Inconsistent error message for unqualifed address of
member
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: tdelisle at uwaterloo.ca
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
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.
--
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/20170131/2f9532bf/attachment.html>
More information about the llvm-bugs
mailing list