[llvm-bugs] [Bug 42840] New: struct method pointer definition fails if using decltype to determine the struct type
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 31 02:27:54 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42840
Bug ID: 42840
Summary: struct method pointer definition fails if using
decltype to determine the struct type
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: niklas at nolte.dev
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
The code:
template<typename s>
using id = s;
template<typename OUT>
struct Functor {
auto invoke () {
return true;
}
};
int main () {
Functor<bool> f{};
bool(Functor<bool>::*working)() = &decltype(f)::invoke;
bool(decltype(f)::*not_working)() = &decltype(f)::invoke; // doesn't work,
parsing seems to fail
bool(id<decltype(f)>::*working_decay_t)() = &decltype(f)::invoke; // can
make it work by wrapping into id
auto working_cast =
static_cast<bool(decltype(f)::*)()>(&decltype(f)::invoke);
}
The error:
<source>:14:23: error: expected unqualified-id
bool(decltype(f)::*not_working)() = &decltype(f)::invoke;
^
See godbolt: https://godbolt.org/z/IVrbZY
I hope the code speaks for itself, everything i could say here would only be
speculation.
Thanks for taking care!
Cheers
--
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/20190731/398714e9/attachment-0001.html>
More information about the llvm-bugs
mailing list