Closed ClawmanCat closed 6 months ago
Thanks for the report, I'll take a look as soon as possible. I should have access to a machine with MSVC again and I'll see what's gone wrong.
I can confirm the problem, but all workaround I found only works with very recent MSVC versions so I cannot apply a fix. All other MSVC version will crash with an internal compiler error.
An imperfect workaround would be to map the type only for non const references:
struct service_2 {
friend auto service_map(service_2&) -> kgr::autowire_single;
// ...
};
The service map in kangaru 4 is not precise enough to allow mapping other types reference type in addition without quickly running into issues.
Describe the bug Using move-only types (deleted copy constructor/assignment operator) as services produces compile errors in various situations with MSVC where it does not with Clang. For example:
kgr::container::invoke
to access a service that is of a move-only type.kgr::container::service
or accessing it throughkgr::container::invoke
(Constructing the move-only type itself throughkgr::container::service
does seem to work however).To Reproduce The following code will compile without any issues with Clang but fail to compile when using MSVC:
MSVC will fail to compile with the following error:
Given the same struct definitions as above, the following also compiles with Clang but not MSVC:
MSVC gives the following error:
Expected behavior I did not see any limitations against move-only service types on the wiki, so I would expect it to compile. Either way, the behaviour should be consistent between compilers.
kgr::debug::service<service_2>()
does also not list any issues, which I would expect if this was not allowed.Desktop (please complete the following information):
version 15.0.3 x86_64-pc-windows-msvc
)version 19.35.32217.1 for x64
)/permissive-
for MSVC.Additional context I also tried using a normal service definition instead of autowiring, the error is the same.