rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Using the removed `&` - operator in a formal parameter assignment will cause an error during codegen

Open mhasel opened this issue 1 year ago • 0 comments

When trying to formally assign an input-parameter with the removed address-of operator &, --check will not report any errors.

VAR_GLOBAL
        global : DINT;
END_VAR

  PROGRAM prog
      VAR_INPUT
          input : REF_TO DINT;
      END_VAR
  END_PROGRAM

FUNCTION main : DINT
        prog(input := &global);
END_FUNCTION

The compilation will fail during codegen with:

error[E071]: no type hint available for EmptyStatement
   ┌─ target/demo.st:12:23
   │
12 │         prog(input := &global);
   │                       ^ no type hint available for EmptyStatement

Compilation aborted due to previous errors.

mhasel avatar Sep 10 '24 13:09 mhasel