[llvm-bugs] [Bug 27918] New: Incomplete initializer when using metafunction in trailing return type
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri May 27 15:50:31 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27918
Bug ID: 27918
Summary: Incomplete initializer when using metafunction in
trailing return type
Product: clang
Version: 3.8
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++14
Assignee: unassignedclangbugs at nondot.org
Reporter: barry.revzin at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Consider this code (simplified from
http://stackoverflow.com/q/37493026/2069064, see also
http://coliru.stacked-crooked.com/a/0d9e9c1dacac6961):
#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.
--
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/20160527/d7caf964/attachment.html>
More information about the llvm-bugs
mailing list