[llvm-bugs] [Bug 32898] New: Overloaded method pointer's public/private access isn't resolved correctly
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue May 2 20:19:53 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=32898
Bug ID: 32898
Summary: Overloaded method pointer's public/private access
isn't resolved correctly
Product: clang
Version: 4.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: russ.schaaf at superevilmegacorp.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
The following code fails to compile on clang 4.0.0 - it compiles with earlier
versions of clang, as well as several other compilers I've tried:
template<typename T, void(T::*pMethod)()>
void methodThunk() {}
// If this isn't a template function, the code compiles
template<typename Type>
void registerCallback(void(*fn)()) {}
class C
{
public:
// Commenting this overload out makes the code compile
void onUpdate(int i) {} // Unrelated overload, with no implementation
private:
void onUpdate() {} // This is the one I want to use for a template arg
void doSomething()
{
// ERROR IS HERE -------------------v
registerCallback<int>(&methodThunk<C, &C::onUpdate>);
}
};
Error is:
<source>:20:51: error: 'onUpdate' is a private member of 'C'
registerCallback<int>(&methodThunk<C, &C::onUpdate>);
~~~^~~~~~~~
<source>:20:32: note: while substituting explicitly-specified template
arguments into function template 'methodThunk'
registerCallback<int>(&methodThunk<C, &C::onUpdate>);
^
<source>:20:9: note: while substituting deduced template arguments into
function template 'registerCallback' [with Type = int]
registerCallback<int>(&methodThunk<C, &C::onUpdate>);
^
1 error generated.
Compiler exited with result code 1
--
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/20170503/d77e1fe0/attachment.html>
More information about the llvm-bugs
mailing list