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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs