[LLVMbugs] [Bug 22588] New: Error when explicitly specify template parameters for variadic template function that uses variadic arguments in return type specification
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Feb 14 08:44:04 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22588
Bug ID: 22588
Summary: Error when explicitly specify template parameters for
variadic template function that uses variadic
arguments in return type specification
Product: clang
Version: 3.5
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: yyc1992 at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 13864
--> http://llvm.org/bugs/attachment.cgi?id=13864&action=edit
source file
Might be related to 22191 but at least the symptom is different.
Source file that produces the error (Also attached).
```
#include <utility>
#include <functional>
template<typename Func, typename... Args>
static inline auto
caller(Func &&func, Args&&... args)
-> decltype(func(std::forward<Args>(args)...))
// Changes to `-> void` suppresses the error
{
return func(std::forward<Args>(args)...);
}
template<typename Func, typename... Args>
static inline auto
wrapper(Func &&func, Args&&... args)
-> decltype(caller(std::forward<Func>(func),
std::forward<Args>(args)...))
{
return caller<Func, Args...>(std::forward<Func>(func),
std::forward<Args>(args)...);
}
int
main()
{
wrapper([] () {}); // OK
wrapper([] (void*) {}, nullptr); // Error on Clang 3.5.1
return 0;
}
```
Error message produced on Clang 3.5.1
```
main2.cpp:18:12: error: no matching function for call to 'caller'
return caller<Func, Args...>(std::forward<Func>(func),
^~~~~~~~~~~~~~~~~~~~~
main2.cpp:26:5: note: in instantiation of function template specialization
'wrapper<(lambda at main2.cpp:26:13), nullptr_t>' requested here
wrapper([] (void*) {}, nullptr);
^
main2.cpp:6:1: note: candidate template ignored: substitution failure [with
Func =
(lambda at main2.cpp:26:13), Args = <nullptr_t>]: pack expansion contains
parameter packs 'Args' and 'args' that have different lengths (1 vs. 2)
caller(Func &&func, Args&&... args)
^
1 error generated.
```
GCC 4.9.2 compiles it without an error.
--
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/20150214/d305bb54/attachment.html>
More information about the llvm-bugs
mailing list