svls icon indicating copy to clipboard operation
svls copied to clipboard

Linter erroneously flags pure virtual functions

Open palchak-google opened this issue 4 years ago • 1 comments

The following code is valid SystemVerilog (confirmed here):

package test_pkg;
  virtual class Class;
    pure virtual function automatic void func1();
    pure virtual function automatic void func2();
  endclass
endpackage

The linter erroneously flags the second function declaration as invalid syntax. image

It appears that the linter is assuming that every function will have an endfunction, but this is not true for pure virtual functions.

palchak-google avatar Mar 19 '21 22:03 palchak-google

Thank you for your report. In language specification, automatic is not allowed in pure virtual function.

class_method ::= pure virtual { class_item_qualifier } method_prototype ;
method_prototype ::= function_prototype 
function_prototype ::= function data_type_or_void function_identifier [ ( [ tf_port_list ] ) ] 

I know some tools allow this invalid syntax, but svls check it strictly for interoperability.

dalance avatar Mar 20 '21 03:03 dalance