cppfront
cppfront copied to clipboard
[BUG] parens are not preserved when used for calculating argument value
trafficstars
Parens disappear when used inside function call to calculate value of argument.
Given cpp2 code:
f: (x:_) = {}
main: () -> int = {
i := 2;
f((i+(i+1)*2)/2);
}
When compiled with cppfront we get (I am skipping the boilerplate)
[[nodiscard]] auto main() -> int{
auto i { 2 };
f( i + i + 1 * 2 / 2);
}
all parens inside the function call are gone. (i+(i+1)*2)/2 is not equal i + i + 1 * 2 / 2.
The expectation is that all parens used to calculate arguments will last cppfront compilation.