16290, “e-kayrakli”, “Compiler-generated initializers do not copy domain formals when assigning to fields”, “2020-08-25T22:00:16Z”
In the code below, c.D = {1..5}
assignment changes the domain of arr
. We
expect that to be a constant domain.
class MyClass {
var D;
var A: [D] int;
/*
// uncomment this to get the desired behavior
proc init(d) {
this.D = d;
}
*/
}
var arr = [1,2,3];
var c = new MyClass(arr.domain);
c.D = {1..5};
writeln("These should be different:");
writeln(c.A.domain);
writeln(arr.domain);
Having a user-defined initializer is the work-around.