Name: Anonymous 2012-07-16 19:25
/prog/, why doesn't this code compile?
It fails with "error: no matching function for call to 'forward(int&)'". As far as I can see I am only calling std::forward on a const int&.
It fails with "error: no matching function for call to 'forward(int&)'". As far as I can see I am only calling std::forward on a const int&.
#include <utility>
class Test
{
public:
template <typename... Args>
Test(Args... args)
{}
};
template <typename... Args>
Test make_test(Args... args)
{
return Test{std::forward<Args...>(args)...};
}
int main()
{
auto x = make_test(5, 6);
return 0;
}