Closed bjorn-jaes closed 7 months ago
Yeah, it's very likely to be related to the new policy. Looking at the diff https://github.com/boost-ext/sml/compare/v1.1.9...v1.1.10 that's pretty much all the changes in that area.
To get the old behavior, can you try with -DBOOST_SML_CREATE_DEFAULT_CONSTRUCTIBLE_DEPS
?
Also, would it be possible to get godbolt link with reproduction, that would defo speed up the investigation. Thanks.
I created a compiler explorer project (godbolt) here. I was able to reproduce the error there using a more minimal example from my library. I included the headers for SML version 9 and 11 in the project so that you can swap between them using the include at the start of the example.cpp file. I have not used compiler explorer that much before so didn't know if there was an easier way of including the library. In any case the code will compile on version 9 and fail on version 11.
Thanks, that really helpful. So indeed the default behavior has changed since version 10+ to improve the required storage requirements. It should be more visible in the error message, will work on that. Unfortunately, that's a breaking change. too. There are 2 ways to fix it without changing sml.
Define BOOST_SML_CREATE_DEFAULT_CONSTRUCTIBLE_DEPS
which brings old behavior
Create missing dependencies and pass them via constructor
address_claimer::st_has_address st_has_address{};
address_claimer::st_claiming st_claiming{};
boost::sml::sm<address_claimer> state_machine_{addr_claimer_, net, st_has_address, st_claiming};
Let me know if that works for you and if there is anything else which can be done to improve it?
Thank you, I am pretty sure I now understand the issue. So my misunderstanding was that I thought that states did not count as dependencies. While in reality any object that is in guard or function / lambda (that is not the event) is a dependency. Given that all my states were default construable this was not that obvious. I will be fixing my code by passing in my states as dependencies (2).
I checked the examples for data and see that it is still are using
define BOOST_SML_CREATE_DEFAULT_CONSTRUCTIBLE_DEPS
to allow the Interrupted
object to be default constructed, so it does not need to be included in the state machine constructor. I also noticed that is example that an instance Connected
is created directly in the constructor to change the default value of the state. This was also no allowed in the latest version. Not sure if that documentation in data example should be updated?
Expected Behavior
As part of a reinstall I changed from version 1.1.9 of SML to the latest version 1.1.11 and expected my code to build without any issues, as it had done before on versions less than 1.1.10.
Actual Behavior
When building the tests for my Jay library the tests fail to build with the following error message:
The constructor with the missing parameter is statemachine in the code bellow:
With the state machine being declared as follows:
From I can interpret from the error message it seems to suggest that the i am missing a st_claiming instance from my constructor? Though I am not sure that is correct, as my state machine should only require an instance of an address_claimer and the only additional dependency should be a network instance.
My Suspicions
I am a bit stuck on interpreting the error message as am not familiar enough with template coding to interpret the SML source code. I did look thought the change log to see if I could spot anything obvious and was wondering if any of the following additions might be the cause of the issue:
This I imagine would be the most likely thing i could imagine to change the construction works. Thought I cant find any example or documentation on how anything would be that much different from before.
Steps to Reproduce the Problem
Specifications