Array Method .sum() for multiple dimension array

In reply to dave_59:

Thank you, Dave.
I know LRM mentioned the answer you provide.
But it doesn’t work for Cadence or Synopsys compiler
I think they updated compiler to support following syntax, it works in my local and edaplayground website.
maybe you should update LRM, you are our Yoda.


class tmp;
    rand int box0[3][3];
    constraint c {
        foreach(box0[i,j]) {
            box0[i][j] inside {[0:10]};
        }
        box0.sum() inside {[1:10]};
    }
endclass

module automatic test;
  
  function void run;
    tmp tmp_h = new();
    tmp_h.randomize();
    $display("box0 = %p", tmp_h.box0);
  endfunction

  initial run();
  
endmodule