16478, “mppf”, “Function expecting param argument can be passed a non-param value”, “2020-09-26T00:54:28Z”
Summary of Problem
A function expecting a param
argument can be passed a non-param
value.
I would expect the following program not to compile, because parSafe
is not a param when passed to R.init
.
use List;
record R {
type eltType;
param parSafe = false;
proc init(type eltType, bub: eltType, param parSafe = false) {
this.eltType = eltType;
this.parSafe = parSafe;
}
}
proc makeThing(const ref x: list(?t), bub: x.type, parSafe: bool = false) {
var x: t;
var h = new R(t, x, parSafe);
return h;
}
var l:list(int) = [2, 1, 3];
var h = makeThing(l, l);
writeln(h);
Steps to Reproduce
Associated Future Test(s):
test/functions/resolution/error-expected-param-missing2.chpl