Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile with gcc 10 #469

Closed
JulZimmermann opened this issue May 19, 2020 · 6 comments · Fixed by #491
Closed

Can't compile with gcc 10 #469

JulZimmermann opened this issue May 19, 2020 · 6 comments · Fixed by #491

Comments

@JulZimmermann
Copy link

Expected Behavior

Expected to compile.

Actual Behavior

Can't compile the quick guide example (or any other application using boost::di) with the gcc 10 compiler

Error Message:

<source>: In member function 'boost::di::v1_1_0::core::binder::resolve_template_t<boost::di::v1_1_0::core::injector<TConfig, TPolicies, TDeps>, boost::di::v1_1_0::aux::identity<T<> > > boost::di::v1_1_0::core::injector<TConfig, TPolicies, TDeps>::create() const':

<source>:2575:77: error: 'boost::di::v1_1_0::core::binder::resolve_template_t<boost::di::v1_1_0::core::injector<TConfig, TPolicies, TDeps>, boost::di::v1_1_0::aux::identity<T<> > > boost::di::v1_1_0::core::injector<TConfig, TPolicies, TDeps>::create() const' is deprecated: creatable constraint not satisfied [-Werror=deprecated-declarations]

 2575 |     return __BOOST_DI_TYPE_WKND(type) create_impl<aux::true_type>(aux::type<type>{});

      |                                                                             ^~~~

<source>:2571:3: note: declared here

 2571 |   create()

      |   ^~~~~~

<source>: In member function 'boost::di::v1_1_0::core::binder::resolve_template_t<boost::di::v1_1_0::core::injector<TConfig, boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<> >, TDeps ...>, boost::di::v1_1_0::aux::identity<T<> > > boost::di::v1_1_0::core::injector<TConfig, boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<> >, TDeps ...>::create() const':

<source>:2803:77: error: 'boost::di::v1_1_0::core::binder::resolve_template_t<boost::di::v1_1_0::core::injector<TConfig, boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<> >, TDeps ...>, boost::di::v1_1_0::aux::identity<T<> > > boost::di::v1_1_0::core::injector<TConfig, boost::di::v1_1_0::core::pool<boost::di::v1_1_0::aux::type_list<> >, TDeps ...>::create() const' is deprecated: creatable constraint not satisfied [-Werror=deprecated-declarations]

 2803 |     return __BOOST_DI_TYPE_WKND(type) create_impl<aux::true_type>(aux::type<type>{});

      |                                                                             ^~~~

<source>:2799:3: note: declared here

 2799 |   create()

      |   ^~~~~~

cc1plus: some warnings being treated as errors

Compiler returned: 1

Steps to Reproduce the Problem

  1. Use gcc 10 compiler
  2. compile the example

Here is a Compiler Explorer link showing the problem: https://godbolt.org/z/xvHTfd
By switching the compiler to gcc 9.3 the code compiles just fine.

Specifications

  • Version: Current Version from "Get the latest header here"
  • Platform: Linux
@krzysztof-jusiak
Copy link
Collaborator

Hmm, it seems like a GCC bug to me, it tries to eagerly instantiate create function for template<class...> which shouldn't even match the overload set and bails out on the deprecated warning

After commenting the warning it seems to work 🤔
https://godbolt.org/z/shDx7e

Needs some more digging, though 🐛

@JulZimmermann
Copy link
Author

Any update on this? It's really sad not to be able to use GCC 10 because of this 😕

As a workaround, I defined __BOOST_DI_DEPRECATED with nothing. Are there any drawbacks to this?

@AnatoliyYakimov
Copy link

Still getting this error with Msys2 MinGW 9.3.0 (x86_64-w64-mingw32/9.3.0).
Defining __BOOST_DI_DEPRECATED as nothing helps, but this is not good solution still.

@JulZimmermann
Copy link
Author

Meanwhile I think the problem is bigger then GCC 10 (and apparently mingw 9) support.

Undefining __BOOST_DI_DEPRECATED helped me with the error messages when forgeting to register a type.
With __BOOST_DI_DEPRECATED I always get obscure template creation error messages similar to the one in my first post. Without it, the compiler gives a straight 2 line message about the missing type.

So, I think there is a problem with __BOOST_DI_DEPRECATED in general. I will keep define it as nothing.

krzysztof-jusiak added a commit to krzysztof-jusiak/di that referenced this issue Jul 21, 2020
…oost-ext#469

Problem:
- GCC has a bug in which improperly instantiate function with
  `template<class...> class T` which triggers deprecated attribute warning.

Solution:
- Add another template parameter for `create` which instantiate `template<class...> class T` seem to wknd/fix the issue.
krzysztof-jusiak added a commit to krzysztof-jusiak/di that referenced this issue Jul 21, 2020
…oost-ext#469

Problem:
- GCC has a bug in which improperly instantiate function with
  `template<class...> class T` which triggers deprecated attribute warning.

Solution:
- Add another template parameter for `create` which instantiate `template<class...> class T` seem to wknd/fix the issue.
krzysztof-jusiak added a commit that referenced this issue Jul 22, 2020
…469

Problem:
- GCC has a bug in which improperly instantiate function with
  `template<class...> class T` which triggers deprecated attribute warning.

Solution:
- Add another template parameter for `create` which instantiate `template<class...> class T` seem to wknd/fix the issue.
@krzysztof-jusiak
Copy link
Collaborator

Should be fixed now -> https://godbolt.org/z/E7xzxE by krzysztof-jusiak@732b7d2

@mloskot
Copy link

mloskot commented Jun 6, 2022

Hmm, it seems like a GCC bug to me

For the archive records, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95302

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants