boost-ext / sml

C++14 State Machine library
https://boost-ext.github.io/sml
Boost Software License 1.0
1.16k stars 179 forks source link

Fix bug in dep resolution when requesting a "const T*" #579

Closed J-Meyers closed 1 year ago

J-Meyers commented 1 year ago

Duplicate of #347

Hello, I have fixed a bug in dependency resolution when requesting a "const T" after injecting a "T" as dependency.

Before this fix, if a T was injected as dependency, requesting a const T will result in a invalid nullptr. The dependency resolution of objects passed by reference is not affected by this problem.

I have added four tests:

dependencies_with_reference dependencies_with_const_reference dependencies_with_pointer dependencies_with_const_pointer (this test fails without the fix) I am new to TMP and this is my first contribute in general so I hope I didn't do anything wrong.

I recently encountered this same issue, figured I'd resolve any merge conflicts so that it's able to be merged in.