Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

c++

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&.


#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;
}

Name: Anonymous 2012-07-16 19:48

But I'm not calling forward(int&) anywhere!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List