boost-ext / di

C++14 Dependency Injection Library
https://boost-ext.github.io/di
1.13k stars 137 forks source link

MSVC 16.6.5 will not compile the simplest code using di.hpp!! #498

Open juandent opened 3 years ago

juandent commented 3 years ago

Expected Behavior

The minimum code fragment below should compile without errors...

Actual Behavior

compilation throws all these errors:

1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2937): error C2641: cannot deduce template arguments for 'boost::di::v1_1_0::core::successful::wrapper' 1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2937,1): error C2783: 'boost::di::v1_1_0::core::successful::wrapper<T,TWrapper> boost::di::v1_1_0::core::successful::wrapper(void)': could not deduce template argument for 'T' 1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2444): message : see declaration of 'boost::di::v1_1_0::core::successful::wrapper' 1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2937,1): error C2783: 'boost::di::v1_1_0::core::successful::wrapper<T,TWrapper> boost::di::v1_1_0::core::successful::wrapper(void)': could not deduce template argument for 'TWrapper' 1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2444): message : see declaration of 'boost::di::v1_1_0::core::successful::wrapper' 1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2946,2): error C2512: 'boost::di::v1_1_0::core::successful::wrapper': no appropriate default constructor available 1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2946,2): message : The target type has no constructors 1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2946,24): error C2064: term does not evaluate to a function taking 1 arguments 1>C:\vcpkg\installed\x86-windows\include\boost\di.hpp(2762,12): error C2440: 'type cast': cannot convert from 'void' to 'T &&'

Steps to Reproduce the Problem

1.Type the following:

#include <boost/di.hpp>

namespace di = boost::di;

struct view
{
    view() {}
};
struct model
{
    model() {}

};
struct controller
{
    controller(model, view) {}
};
struct app
{
    app(controller ) {}
};
void useDI()
{
    auto app_ = di::make_injector().create<app>();
}

Specifications

juandent commented 3 years ago

Can someone confirm this?

krzysztof-jusiak commented 3 years ago

I can neither confirm nor deny regarding 16.6.5 version. Tested MSVC versions on CI are passing with both C++14 and C++17 though :thinking: