Member access on a non-auto-deref pointer base
Member access (base.member) requires base to be a struct, function-block, or class instance — not a pointer to one. The compiler will not implicitly dereference pointers when they appear on the left of a . (auto-dereferencing applies only to REFERENCE TO / alias pointers).
This rule covers three cases that share the same underlying shape — the value of base is a pointer, not the pointee:
THISisPOINTER TO <enclosing FUNCTION_BLOCK>. UseTHIS^.member.SUPERisPOINTER TO <parent POU>(before dereferencing). UseSUPER^.member.- A user-declared
POINTER TO ...variable. Use<pointer>^.member.
Example of invalid use
FUNCTION_BLOCK fb
VAR
a : DINT;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK other
VAR
p_fb : POINTER TO fb;
END_VAR
METHOD m : DINT
p_fb.a := 1; // Error: Cannot access `a` on `POINTER TO fb`
THIS.b := 2; // Error: Cannot access `b` on `POINTER TO other` (THIS is a pointer)
END_METHOD
END_FUNCTION_BLOCK
Example of valid use
FUNCTION_BLOCK other
VAR
p_fb : POINTER TO fb;
b : DINT;
END_VAR
METHOD m : DINT
p_fb^.a := 1; // Dereference the pointer first
THIS^.b := 2; // Dereference THIS first
END_METHOD
END_FUNCTION_BLOCK