boost-ext / di

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

Does not compile on the newest Visual Studio Preview version (15.7 Preview 3.0) #326

Closed nimashoghi closed 6 years ago

nimashoghi commented 6 years ago

Behavior

I cannot compile anything if I use Microsoft Visual Studio 15.7 Preview 3.0. Basic object graphs (that compile perfectly fine on 15.6) do not compile. The compile error is shown below:

Severity    Code    Description File    Project Line    Suppression State
Error   C2248   'boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>::try_create<boost::di::v1_1_0::core::any_type_1st_ref_fwd<T>>': cannot access protected struct declared in class 'boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>' c:\users\nimas\source\repos\di_test\di_test\di.hpp  di_test 2346

Full compile log:

1>------ Rebuild All started: Project: di_test, Configuration: Debug Win32 ------
1>stdafx.cpp
1>di_test.cpp
1>c:\users\nimas\source\repos\di_test\di_test\di.hpp(2346): error C2248: 'boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>::try_create<boost::di::v1_1_0::core::any_type_1st_ref_fwd<T>>': cannot access protected struct declared in class 'boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>'
1>        with
1>        [
1>            TConfig=boost::di::v1_1_0::config
1>        ]
1>        and
1>        [
1>            T=test
1>        ]
1>        and
1>        [
1>            TConfig=boost::di::v1_1_0::config
1>        ]
1>c:\users\nimas\source\repos\di_test\di_test\di.hpp(2346): note: see declaration of 'boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>::try_create<boost::di::v1_1_0::core::any_type_1st_ref_fwd<T>>'
1>        with
1>        [
1>            TConfig=boost::di::v1_1_0::config
1>        ]
1>        and
1>        [
1>            T=test
1>        ]
1>c:\users\nimas\source\repos\di_test\di_test\di.hpp(2926): note: see declaration of 'boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>'
1>        with
1>        [
1>            TConfig=boost::di::v1_1_0::config
1>        ]
1>c:\users\nimas\source\repos\di_test\di_test\di.hpp(1855): note: see reference to class template instantiation 'boost::di::v1_1_0::core::try_provider<boost::di::v1_1_0::aux::pair<T,boost::di::v1_1_0::aux::pair<boost::di::v1_1_0::type_traits::direct,boost::di::v1_1_0::aux::type_list<boost::di::v1_1_0::core::any_type_1st_ref_fwd<T>>>>,boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>,boost::di::v1_1_0::providers::stack_over_heap>::is_creatable<boost::di::v1_1_0::type_traits::memory_traits<T,int>::type>' being compiled
1>        with
1>        [
1>            T=test,
1>            TConfig=boost::di::v1_1_0::config
1>        ]
1>c:\users\nimas\source\repos\di_test\di_test\di.hpp(2349): note: while compiling class template member function 'enable_if<B,T>::type boost::di::v1_1_0::core::try_provider<boost::di::v1_1_0::aux::pair<test,boost::di::v1_1_0::aux::pair<boost::di::v1_1_0::type_traits::direct,boost::di::v1_1_0::aux::type_list<boost::di::v1_1_0::core::any_type_1st_ref_fwd<test>>>>,boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>,boost::di::v1_1_0::providers::stack_over_heap>::get(const TMemory &) const'
1>        with
1>        [
1>            T=conditional<B,test,test*>::type,
1>            TConfig=boost::di::v1_1_0::config
1>        ]
1>c:\users\nimas\source\repos\di_test\di_test\di_test.cpp(20): note: see reference to class template instantiation 'boost::di::v1_1_0::core::injector<TConfig,boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<>>>::is_creatable<test,boost::di::v1_1_0::no_name,boost::di::v1_1_0::aux::true_type>' being compiled
1>        with
1>        [
1>            TConfig=boost::di::v1_1_0::config
1>        ]
1>Done building project "di_test.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Steps to Reproduce the Problem

  1. Install Microsoft Visual Studio 15.7 Preview 3.0 and try to compile a very basic object graph. Sample reproduction code shown below:
    
    #include "stdafx.h"
    #include "di.hpp"

using namespace boost::di;

struct test2 { };

struct test { test(test2 &) { } };

int main() { auto injector{make_injector()}; injector.create();

return 0;

}



## Specifications

  - Version: 1.1.0
  - Platform: Microsoft Visual Studio 15.7 Preview 3.0