<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 --- - Incomplete initializer when using metafunction in trailing return type"
href="https://llvm.org/bugs/show_bug.cgi?id=27918">27918</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incomplete initializer when using metafunction in trailing return type
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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++14
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>barry.revzin@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider this code (simplified from
<a href="http://stackoverflow.com/q/37493026/2069064">http://stackoverflow.com/q/37493026/2069064</a>, see also
<a href="http://coliru.stacked-crooked.com/a/0d9e9c1dacac6961">http://coliru.stacked-crooked.com/a/0d9e9c1dacac6961</a>):
#include <utility>
template <typename Function, typename... Args>
auto Call(Function func, Args... args)
#if TRAILING == 1
-> std::result_of_t<Function&(Args...)>
#elif TRAILING == 2
-> typename std::result_of<Function&(Args...)>::type
#endif
{
return func(args...);
}
int main()
{
auto call = Call<int(int), int>;
(void)call;
}
When compiling with -DTRAILING=0 or -DTRAILING=1, the code compiles fine. When
compiling with -DTRAILING=2, clang emits:
main.cpp:16:10: error: variable 'call' with type 'auto' has incompatible
initializer of type '<overloaded function type>'
auto call = Call<int(int), int>;
^ ~~~~~~~~~~~~~~~~~~~
1 error generated.
gcc compiles the code in all cases.</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>