boost-ext / di

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

Unable the compile example in IAR Embedded Workbench for ARM 8.50.5 #496

Open jnewcomb opened 3 years ago

jnewcomb commented 3 years ago

I do understand this is not an officially supported compiler, so I don't expect any changes to the library. Also while the IAR compiler 'claims' to support C++14, I have my doubts! https://www.iar.com/support/resources/articles/exploring-c11-and-c14/ My level of C++ is not good enough to dig deeper into the header file, so reporting how far I got. If you have got this working, please comment below with suggested edits.

Expected Behavior

Compile without errors. Note: The compiler states__attribute__((unused)) is supported

Steps to Reproduce the Problem

  1. Forced preprocessor to assume #define __GNUC__
  2. Compile basic example

Actual Behavior

Error[Pe738]: a class-qualified name is required C:\Projects\C++\DI\boost\di.hpp 2341 (Highlights 'type') Error[Pe065]: expected a ";" C:\Projects\C++\DI\boost\di.hpp 2341 (Highlights __BOOST_DI_UNUSED)

struct arg_wrapper<T, TName, TIsRoot, TList<TCtor...>, TDependency, TDeps> { using type __BOOST_DI_UNUSED = T; ... };

Steps taken to fix

  1. Take code from above
  2. Change #define __BOOST_DI_UNUSED __attribute__((unused)) to #define __BOOST_DI_UNUSED

Actual Behavior

It compiles if the injector is not used. With injector usage, I get: This line struct is_constructible : decltype(test_is_constructible<T, TArgs...>(0)) {}; - Compiler highlights (0) with this error: Error[Pe871]: template instantiation resulted in unexpected function type of "boost::ext::di::v1_2_0::aux::true_type (int)" (the meaning of a name may have changed since the template declaration -- the type of the template is C:\Projects\C++\DI\boost\di.hpp 544 "boost::ext::di::v1_2_0::aux::true_type (int)") detected during: instantiation of "boost::ext::di::v1_2_0::aux::test_is_constructible" based on template arguments <boost::ext::di::v1_2_0::core::dependency<boost::ext::di::v1_2_0::scopes::instance, bool, bool &,
boost::ext::di::v1_2_0::no_name, void, boost::ext::di::v1_2_0::core::none>, boost::ext::di::v1_2_0::core::dependency<boost::ext::di::v1_2_0::scopes::instance, bool, bool &, boost::ext::di::v1_2_0::no_name, void,
boost::ext::di::v1_2_0::core::none> &&> at line 544 instantiation of class "boost::ext::di::v1_2_0::aux::is_constructible<T, TArgs...> [with T=boost::ext::di::v1_2_0::core::dependency<boost::ext::di::v1_2_0::scopes::instance, bool, bool &,
boost::ext::di::v1_2_0::no_name, void, boost::ext::di::v1_2_0::core::none>, TArgs=<boost::ext::di::v1_2_0::core::dependency<boost::ext::di::v1_2_0::scopes::instance, bool, bool &, boost::ext::di::v1_2_0::no_name, void,
boost::ext::di::v1_2_0::core::none> &&>]" at line 734 instantiation of class "boost::ext::di::v1_2_0::concepts::is_supported [with TDeps=<boost::ext::di::v1_2_0::core::dependency<boost::ext::di::v1_2_0::scopes::instance, bool, bool &,
boost::ext::di::v1_2_0::no_name, void, boost::ext::di::v1_2_0::core::none>>]" at line 834 instantiation of class "boost::ext::di::v1_2_0::concepts::boundable__ [with Ts=<boost::ext::di::v1_2_0::aux::type_list<boost::ext::di::v1_2_0::core::dependency<boost::ext::di::v1_2_0::scopes::instance, bool,
bool &, boost::ext::di::v1_2_0::no_name, void, boost::ext::di::v1_2_0::core::none>>>]" at line 109 of "C:\Projects\C++\DI\main.cpp"

Specifications

... If you wish to play, there is a free compiler limited to 32KB, enough to build all examples. https://www.iar.com/iar-embedded-workbench/#!?architecture=Arm