<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - struct method pointer definition fails if using decltype to determine the struct type"
href="https://bugs.llvm.org/show_bug.cgi?id=42840">42840</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>struct method pointer definition fails if using decltype to determine the struct type
</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>normal
</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>niklas@nolte.dev
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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: <a href="https://godbolt.org/z/IVrbZY">https://godbolt.org/z/IVrbZY</a>
I hope the code speaks for itself, everything i could say here would only be
speculation.
Thanks for taking care!
Cheers</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>