Skip to content

Commit

Permalink
Merge pull request #2302 from lf-lang/cpp-set-zero
Browse files Browse the repository at this point in the history
Disambiguate set(0) for C++ ports
  • Loading branch information
cmnrd committed May 31, 2024
2 parents 030f93b + f731d64 commit ca30b0c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/cpp/reactor-cpp
27 changes: 27 additions & 0 deletions test/Cpp/src/SetZero.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
target Cpp

reactor Source {
output out: unsigned

reaction(startup) -> out {=
out.set(0);
=}
}

reactor Sink {
input in: unsigned

reaction(startup, in) {=
if (!in.is_present() || *in.get() != 0) {
std::cerr << "Expected to receive 0\n";
exit(1);
}
std::cout << "Success!\n";
=}
}

main reactor {
source = new Source()
sink = new Sink()
source.out -> sink.in
}

0 comments on commit ca30b0c

Please sign in to comment.