About a error reported by gcc
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Jul 5 10:31:00 GMT 2018
On Thu, 5 Jul 2018 at 02:14, snow_xmas wrote:
>
> Hello.
> The source in the attachment can not be compiled, because there is a variable in the lambda-introducer does not have a copy-constructor, but have a move-constructor. When a function object constructed by a lambda-expression like this, the compiler will report this error. And I have try it under gcc version 5.4, 7,3 and 8.1, the same error will be reported by all these versions of gcc. However, the lambda-expression can be moved normally to std::async, std::packaged_task, except std::function. So I believe it's a bug of gcc
No, as explained by Lui Hao.
> The classes which is prohibited to copy but allowed to move is necessary in some condition, like unique_ptr. Please give me a solution for this error.
This is off-topic on this mailing list, please use
gcc-help@gcc.gnu.org next time.
More information about the Gcc
mailing list