Closed
Description
In section 1.3.2 inout parameters
of https://github.com/hsutter/708/blob/main/708.pdf you specify that
If the function is nonvirtual, at least one path must contain a non-const use of x (else the parameter should be in).
In the current implementation of cppfront the following code compiles:
f2: (inout x) -> _ = {
return x * 2;
}
main: () -> int = {
x := 21;
std::cout << f2(x) << std::endl;
x = 0; // workaround for another bug
}
And generate output:
42
Expectations
cppfront should end with an error informing to use in
argument passing instead of inout
.