[sv-ec] local/protected intermediate reference enforcement

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Mon Nov 27 2006 - 14:38:49 PST
The 1800 LRM is not clear on the rules for when "local" and
"protected" are to be enforced.  In particular, in a sequence
of member accesses, if a middle reference would be invalid, is the
entire reference invalid?

Example:

class P;
    int pub;
endclass

class C;
    protected P p;
    function new();
       p = new;
    endfunction
endclass

module top;
   C c = new;
   initial begin
      c.p.pub = 1;   // c.p is protected but c.p.pub is not
   end
endmodule


I think that SV should be restrictive here -- an access is
only valid from a particular point in the source if every
component along the access path is valid to access from
that point in source.  This is what C++ enforces as well.

Gord.
-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Mon Nov 27 14:38:52 2006

This archive was generated by hypermail 2.1.8 : Mon Nov 27 2006 - 14:39:06 PST