in C++11 a lambda function is an object, and it should be possible to call make_tuple with it, right?
void foobar() {
auto t = std::make_tuple([](){ std::make_shared<int>(); });
}
This code works for me.
Now what happens if we add a variadic template:
#include <tuple>
#include <memory>
template <class... T>
void foobar() {
auto t = std::make_tuple([](){ std::make_shared<T>(); }...);
}
int main(int, char**)
{
foobar<int, float, double>();
return 0;
}
This one fails to compile in GCC 4.7.2
main.cpp: In lambda function:
main.cpp:6:54: error: parameter packs not expanded with '...':
main.cpp:6:54: note: 'T'
main.cpp: In function 'void foobar()':
main.cpp:6:57: error: expansion pattern '#'lambda_expr' not supported by dump_expr#<expression error>' contains no argument packs
main.cpp: In instantiation of 'void foobar() [with T = {int, float, double}]':
main.cpp:11:29: required from here
I wonder, is this code correct by the Standard ?