View Revisions: Issue #35580

Summary 0035580: Compiler picks up wrong overload for TMemoryStream.Write(TBytes, Longint);
Revision 2019-05-25 14:33 by Jonas Maebe
Description FPC calls the "Write(const Buffer; Count: Longint)" overload even when the "Write(const Buffer: TBytes; Count: Longint)" should be called.

This is because the TMemoryStream.Write declaration misses the "overload" keyword. See docs: https://www.freepascal.org/docs-html/ref/refsu79.html "There is only one case where the overload modifier is mandatory: if a function must be overloaded that resides in another unit."

The docs should be enhanced as well - it is mandatory for object methods across different classes; not only functions across different units.
Revision 2019-05-13 22:13 by Ondrej Pokorny
Description FPC calls the "Write(const Buffer; Count: Longint)" overload even when the "Write(const Buffer: TBytes; Count: Longint)" should be called.

This is because the TMemoryStream.Write declaration misses the "overload" keyword. See docs: https://www.freepascal.org/docs-html/ref/refsu79.html "There is only one case where the overload modifier is mandatory: if a function must be overloaded that resides in another unit."

The docs should be enhanced as well - it is mandatory for object methods across different classes; not only functions across different units.