boost-ext / di

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

test.injections_concepts: Fails compilation with "-fconcepts" #410

Open jamespharvey20 opened 5 years ago

jamespharvey20 commented 5 years ago

Expected Behavior

test.injections_concepts should be able to compile if __cpp_concepts is defined.

Actual Behavior

At first, test.injections_concepts appears to compile and pass. Technically, it does. And, it's on the website as a "Run this code!" example.

But, with further examination, because -fconcepts isn't used, __cpp_concepts isn't defined, so concepts.cpp winds up being a completely empty main().

Compiling with -fconcepts leads to the attached error, on gcc 9.1. (Similar errors on gcc 6.x, 7.x, 8.x.)

The full errors are attached, but it starts:

In file included from /home/jamespharvey20/home/code/di.git/extension/include/boost/di/extension/injections/concepts.hpp:12,
                 from /home/jamespharvey20/home/code/di.git/extension/test/injections/concepts.cpp:11:
/home/jamespharvey20/home/code/di.git/include/boost/di.hpp:3328:103: error: decltype cannot resolve address of overloaded function
 3328 |       ::boost::di::v1_1_0::detail::combine_t<::boost::di::v1_1_0::aux::function_traits_t<decltype(ctor)>, \
      |                                                                                                       ^
...
/home/jamespharvey20/home/code/di.git/include/boost/di.hpp:3328:104: error: template argument 1 is invalid
 3328 |       ::boost::di::v1_1_0::detail::combine_t<::boost::di::v1_1_0::aux::function_traits_t<decltype(ctor)>, \
      |                                                                                                        ^

I'm thinking it's not built by extension/test/CMakeLists.txt because of these errors, but I'm posting this because: (1) I'm hoping it can be fixed; and (2) as it's on the website as a "Run this code!" it makes it look like it's implemented and working.

Steps to Reproduce the Problem

  1. Modify /CMakeLists.txt to include -fconcepts in CMAKE_CXX_FLAGS for g++.
  2. Modify extension/test/CMakeLists.txt to include test(injections/concepts).
  3. Attempt compiling test.injections.concepts

Specifications

kanstantsin-chernik commented 4 years ago

Actually, I saw the same problem with msvc 19.23 /std:cpp20