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

Forwarding std::string as a parameters to nested reactors does not work as expected #2053

Closed
erlingrj opened this issue Oct 14, 2023 · 1 comment · Fixed by #2164
Closed
Assignees
Labels
bug Something isn't working cpp Related to C++ target

Comments

@erlingrj
Copy link
Collaborator

erlingrj commented Oct 14, 2023

Hi.

This program in the Cpp target did not work as I expected:

target Cpp;

main reactor(s: std::string = "Default", a:int=0) {
  reaction(startup) {=
    reactor::log::Info() << "Main: s=" <<s <<" a=" <<a;
  =}

  r  = new R(s=s, a=a)
}

reactor R(s: std::string = "Default", a:int=0) {
  reaction(startup) {=
    reactor::log::Info() << "R: s=" <<s <<" a=" <<a;
  =}
}

Output:

bin/Test -a 123 -s Hallo
[INFO]  R: s= a=123
[INFO]  Main: s=Hallo a=123

I got the intended behavior by doing the following modification:

r  = new R(s= {= std::string(s)=}, a=a)
@erlingrj erlingrj added the cpp Related to C++ target label Oct 14, 2023
@cmnrd cmnrd added the bug Something isn't working label Oct 14, 2023
@cmnrd
Copy link
Collaborator

cmnrd commented Oct 14, 2023

That is interesting it definitely looks like a bug. Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cpp Related to C++ target
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants