Wrong object class and mode for to_string(call_path ...)
As reported by Abhijit Chakrabarty via email/reflector on 26.11.2020:
Hi Team, We are facing this issue while implementing vhdl-19. Please help us.
Package std.env in Vhdl 2019 has following subprogram specification:
type CALL_PATH_VECTOR_PTR is access CALL_PATH_VECTOR; impure function TO_STRING (call_path : CALL_PATH_VECTOR_PTR; Separator : STRING := "" & LF ) return STRING;
For the first argument,
call_path, both the object class (signal/variable/constant) and the mode (in/out/inout) are not specified. We take class
1076-2019 Section 4.2.2 describes the formal parameters for subprograms.
Section 22.214.171.124 NOTE1 says:
NOTE 1 — Variable class parameters of access and protected types are allowed for procedures and impure functions.
So it is only allowed when object class is variable. As
constant, we error out.
env.vhdl(255): ERROR: formal constant 'call_path' cannot be of an access type
To infer the object class and mode:
For those parameters with modes, the only modes that are allowed for formal parameters of a procedure or an impure function are in, inout, and out. If the mode is in and no object class is explicitly specified, constant is assumed.
For those parameters with modes, the only mode that is allowed for formal parameters of a pure function is the mode in (whether this mode is specified explicitly or implicitly). The object class shall be constant, signal, or file. If no object class is explicitly given, constant is assumed.
It does not explicitly mention the default mode and object class for impure function. We take mode