Skip to content

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

@mhasel

Description

@mhasel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.0This PR/Issue is required before we reach feature completiongood first issueGood for newcomershigh-priorityvalidationcandidate for syntactic or semantic validation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions