data/full_repos/permissive/143278/ivltests/sv_foreach4.v
 line:22: before: "class"
1: b'%Error: data/full_repos/permissive/143278/ivltests/sv_foreach4.v:22: Unsupported: classes\nclass test_t;\n^~~~~\n%Error: data/full_repos/permissive/143278/ivltests/sv_foreach4.v:26: Unsupported: new constructor\n   function new (int ax, int bx);\n            ^~~\n%Error: data/full_repos/permissive/143278/ivltests/sv_foreach4.v:37: Unsupported: classes\n   class container_t;\n   ^~~~~\n%Error: data/full_repos/permissive/143278/ivltests/sv_foreach4.v:40: Unsupported: new constructor\n      function new();\n               ^~~\n%Error: data/full_repos/permissive/143278/ivltests/sv_foreach4.v:45: Unsupported: new with arguments\n   foo[idx1][idx2] = new(idx1,idx2);\n                     ^~~\n%Error: Exiting due to 5 error(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module main;

   class container_t;
      test_t foo [0:3][0:7];

      function new();
	 bit [3:0] idx1, idx2;
	 begin
	    for (idx1 = 0 ; idx1 < 4 ; idx1 = idx1+1) begin
	       for (idx2 = 0 ; idx2 <= 7 ; idx2 = idx2+1)
		 foo[idx1][idx2] = new(idx1,idx2);
	    end
	 end
      endfunction

      task run();
	 bit [3:0] idx1, idx2;
	 test_t tmp;
	 foreach (foo[ia,ib]) begin
	    if (ia > 3 || ib > 7) begin
	       $display("FAILED -- index out of range: ia=%0d, ib=%0d", ia, ib);
	       $finish;
	    end

	    tmp = foo[ia][ib];
	    if (tmp.a !== ia[1:0] || tmp.b !== ib[2:0]) begin
	       $display("FAILED -- foo[%0d][%0d] == %b", ia, ib, {tmp.a, tmp.b});
	       $finish;
	    end

	    foo[ia][ib] = null;
	 end

	 for (idx1 = 0 ; idx1 < 4 ; idx1 = idx1+1) begin
	    for (idx2 = 0 ; idx2 <= 7 ; idx2 = idx2+1)
	      if (foo[idx1][idx2] != null) begin
		 $display("FAILED -- foreach failed to visit foo[%0d][%0d]", idx1,idx2);
		 $finish;
	      end
	 end
      endtask

   endclass

   container_t dut;
   initial begin
      dut = new;
      dut.run;
      $display("PASSED");
   end

endmodule
module main;


   class container_t;
      test_t foo [0:3][0:7];

      function new();
	 bit [3:0] idx1, idx2;
	 begin
	    for (idx1 = 0 ; idx1 < 4 ; idx1 = idx1+1) begin
	       for (idx2 = 0 ; idx2 <= 7 ; idx2 = idx2+1)
		 foo[idx1][idx2] = new(idx1,idx2);
	    end
	 end
      endfunction

      task run();
	 bit [3:0] idx1, idx2;
	 test_t tmp;
	 foreach (foo[ia,ib]) begin
	    if (ia > 3 || ib > 7) begin
	       $display("FAILED -- index out of range: ia=%0d, ib=%0d", ia, ib);
	       $finish;
	    end

	    tmp = foo[ia][ib];
	    if (tmp.a !== ia[1:0] || tmp.b !== ib[2:0]) begin
	       $display("FAILED -- foo[%0d][%0d] == %b", ia, ib, {tmp.a, tmp.b});
	       $finish;
	    end

	    foo[ia][ib] = null;
	 end

	 for (idx1 = 0 ; idx1 < 4 ; idx1 = idx1+1) begin
	    for (idx2 = 0 ; idx2 <= 7 ; idx2 = idx2+1)
	      if (foo[idx1][idx2] != null) begin
		 $display("FAILED -- foreach failed to visit foo[%0d][%0d]", idx1,idx2);
		 $finish;
	      end
	 end
      endtask

   endclass

   container_t dut;
   initial begin
      dut = new;
      dut.run;
      $display("PASSED");
   end

endmodule