when compiled with -Wall GCC 11 will bring up a nonnul warning.
It's probably a false positive, but maybe there is a way to silence this warning inside the library?
Thanks!
Expected Behavior
No warnings
Actual Behavior
in file included from ../diTest.cpp:3:
../boost-di/include/boost/di.hpp: In instantiation of ‘auto boost::ext::di::v1_2_0::make_injector(TDeps ...) [with TConfig = boost::ext::di::v1_2_0::config; TDeps = {}; typename boost::ext::di::v1_2_0::aux::concept_check<typename boost::ext::di::v1_2_0::concepts::boundable__<boost::ext::di::v1_2_0::aux::type_list<T2s ...> >::type>::type <anonymous> = 0; typename boost::ext::di::v1_2_0::aux::concept_check<typename boost::ext::di::v1_2_0::concepts::configurable__<T>::type>::type <anonymous> = 0]’:
../diTest.cpp:14:45: required from here
../boost-di/include/boost/di.hpp:3048:63: warning: ‘this’ pointer is null [-Wnonnull]
3048 | core::injector<TConfig, decltype(((TConfig*)0)->policies((concepts::injector<TConfig>*)0)), TDeps...>{
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../boost-di/include/boost/di.hpp:3041:61: note: in definition of macro ‘__BOOST_DI_MAKE_INJECTOR’
3041 | #define __BOOST_DI_MAKE_INJECTOR(...) detail::make_injector(__VA_ARGS__)
| ^~~~~~~~~~~
../boost-di/include/boost/di.hpp:1965:8: note: in a call to non-static member function ‘auto boost::ext::di::v1_2_0::config::policies(T*) [with T = boost::ext::di::v1_2_0::concepts::injector<boost::ext::di::v1_2_0::config>]’
1965 | auto policies(T*) noexcept {
| ^~~~~~~~
Mimimal Example:
#include <iostream>
#include "boost/di.hpp"
class Bar {
public:
int getI() const { return i; }
private:
int i = 2;
};
int main() {
auto injector = boost::di::make_injector();
auto bar = injector.create<std::shared_ptr<Bar>>();
std::cout << std::to_string(bar->getI()) << std::endl;
}
Hi,
when compiled with
-Wall
GCC 11 will bring up anonnul
warning.It's probably a false positive, but maybe there is a way to silence this warning inside the library?
Thanks!
Expected Behavior
No warnings
Actual Behavior
Mimimal Example:
Specifications