Try_get method in mailbox of system verilog

Hi All,

I have tried to understand try_get method of the IEEE LRM STD-1800:

In the LRM try_get method of the mailbox it is mentioned as “If the type of the message variable is not equivalent to the type of the message in the
mailbox, the method returns a negative integer”.

So i have run a piece this of code mentioned below:

program check;
  class a;
    mailbox #() mbx1;
    function new();
      mbx1 = new(1);
    endfunction
  endclass
  
  initial begin
    int sucess;
    byte k = 'd4;
    int j;
    a a_inst = new();
    a_inst.mbx1.put(k);
    sucess = a_inst.mbx1.try_get(j);
    $display("the value of output == %d",sucess);
  end
endprogram

So as per the LRM when you we are using the try_get method with different message type then the function return a negative number.

But am observing that the try_get function is returning a positive number of 1 with the help of display present in the program block.

Can anyone elaborate this behavior as it is not as per the LRM.

Thanks,
Nikhil

In reply to nchakravarthy:
First, I strongly recommend that you always parameterize mailboxes with a specific type. That way you get a compiler error if you try to put or get something from your mailbox of an incompatible type. Unparameterized mailboxes are left-over from a language that did not have parameterized classes and there is no other feature in SystemVerilog that lets you pass an untyped argument to a class method.

The feature that returns a negative number is later addition to the SystemVerilog standard (1800-2009?). You should get a later version of your tool, or contact your vendor.

In reply to dave_59:

Thanks Dave,

I think the tool support to SV standard (1800-2009) could be the reason for it