JoelFilho/TDP

Visual Studio 2019 - Error C2440 compiling in C++20 mode

Closed this issue · 2 comments

Hi, I Am rying the TDP under VS2109, with some the examples. However, it does not compile and give some errors. More in detail, the example I am using is the 05_producers_with_consumers.cpp and the errors I get from the compiler:

Build started...
1>------ Build started: Project: NPXserver, Configuration: Debug Win32 ------
1>NPXserver.cpp
1>C:\P2019\NPXserver\others\tdp\pipeline.impl.hpp(603,53): error C2440: '': cannot convert from 'initializer list' to 'tdp::detail::partial_pipeline<jtc::type_list<>,F,F_>'
1> with
1> [
1> F=main::<lambda_1>
1> ]
1>C:\P2019\NPXserver\others\tdp\pipeline.impl.hpp(605,1): message : No constructor could take the source type, or constructor overload resolution was ambiguous
1>C:\P2019\NPXserver\NPXserver\NPXserver.cpp(75): message : see reference to function template instantiation 'auto tdp::detail::producer<main::<lambda_1>>::operator >><const main::<lambda_2>&>(Fc) noexcept &&' being compiled
1> with
1> [
1> Fc=const main::<lambda_2> &
1> ]
1>C:\P2019\NPXserver\NPXserver\NPXserver.cpp(75,53): error C2677: binary '>>': no global operator found which takes type 'tdp::detail::consumer' (or there is no acceptable conversion)
1>Done building project "NPXserver.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Hello @massadop, and thanks for trying out TDP!

C++20 changed how aggregates work, with P1008, in a non-backwards-compatible way. So it broke the partial_pipeline template, since it was an aggregate with deleted copy/move constructors.

It should be a quick upgrade path, though I'll also need to upgrade testing for the other compilers with C++20 support now. So I'll only be able to guarantee it's working on every platform in the weekend.

Until then, you can try checking out the update from #11. I've tested it on MSVC 2019 and it seems to be working.

I've merged the solution to the main branch, after confirming the new CI setup works.

Thank you again for the contribution!