P4063

Code

P4063

Message

Member qualifiers are repeated or conflict or are out of order or not allowed here

This error occurs when the member qualifiers on a function block or method break one of these rules:

  • A qualifier appears at most once, and there is at most one access specifier (PUBLIC, PRIVATE, PROTECTED, INTERNAL).

  • The access specifier comes first, before FINAL, ABSTRACT and OVERRIDE. METHOD FINAL PUBLIC M is an error; METHOD PUBLIC FINAL M is not.

  • FINAL and ABSTRACT exclude each other.

  • A function block cannot be PRIVATE, PROTECTED or OVERRIDE.

  • An ABSTRACT method has no body, and only an ABSTRACT function block can declare one.

The message names the rule that is broken. The rules follow what TwinCAT 3.1.4024 accepts.

Example

The following code will generate error P4063, because the access specifier comes after FINAL:

FUNCTION_BLOCK FB_Motor
    VAR
        speed : INT;
    END_VAR

    METHOD FINAL PUBLIC Stop
        speed := 0;
    END_METHOD
END_FUNCTION_BLOCK

To fix this error, put the access specifier first:

FUNCTION_BLOCK FB_Motor
    VAR
        speed : INT;
    END_VAR

    METHOD PUBLIC FINAL Stop
        speed := 0;
    END_METHOD
END_FUNCTION_BLOCK

Think IronPLC is wrong about this?

If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.