Closed marsermd closed 5 years ago
Moreover, if you change
Foo(const std::vector<std::shared_ptr<Bar>>& bars){}
to
Foo(std::vector<std::shared_ptr<Bar>> bars){}
Everything compiles and seems to work in debug.
But in release only Bar2
is getting instantiated. After that, an invalid vector of size 2 is passed as an argument to Foo
. That's a clear sign that there is an UB.
I tested your code at VS 2017 and have no problem with Foo(std::vector<std::shared_ptr<Bar>> bars){}
Reproducible with /c++17 flag
I think we can close it. vector
has valid objects. /std:c++17
is fixed and waited to be merged #365
Expected Behavior
Everything compiles as if there was no
shared_config
.Actual Behavior
Compilation error:
Steps to Reproduce the Problem
Try to compile the following code:
It will fail. But if you remove
boost::di::extension::shared_config
, everything will compile just fine.Specifications