E2584 Weak attribute only allowed on fields and variables of type class or interface: '%s' (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)


This occurs whenever weak references are used with arrays or any other types other than classes and interfaces.

  TMyComponent = class
  private
    [Weak] GiveMe: array of Integer;   // error, an array cannot be weak.
  end;

This can be fixed by using the weak reference with a class instead:

  TMyComponent = class
  private
    [Weak] TS: TStringList; // it’s ok, a class can be weak
  end;

See Also