This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++11 / unique_ptr with packaged_task


This code compiles with clang/libc++, but doesn't with gcc4.8/libstdc++:

#include <functional>
#include <future>
#include <iostream>
#include <memory>
#include <ostream>

struct S
{
        void f()
        {
                std::cerr << "Meep meep\n";
        }
};

int main()
{
        std::unique_ptr<S> sp(new S);
        std::packaged_task<void ()> pt(std::bind(&S::f, std::move(sp)));
        pt();
        std::cerr << "sp is empty: " << std::boolalpha << !sp << std::endl;
}



Is that a bug in gcc?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]