View Issue Details

IDProjectCategoryView StatusLast Update
0037387FPCCompilerpublic2020-07-18 16:38
ReporterHafedh TRIMECHE Assigned To 
Status acknowledgedResolutionopen 
Product Version3.3.1 
Summary0037387: TCustomAttribute applied for Records
Description  TAnyAttribute = class(TCustomAttribute);

    Item : string;

Generates this compilation error:

main.pas(20,5) Fatal: Syntax error, "identifier" expected but "[" found

Would TCustomAttribute be applied to Records not only for classes?
TagsNo tags attached.
Fixed in Revision
Attached Files


Thaddy de Koning

2020-07-18 11:59

reporter   ~0124142

Last edited: 2020-07-18 12:01

View 2 revisions

You can't nest attributes (yet), but this works:
{$mode delphi}
TAnyAttribute = class(TCustomAttribute);
    Item : string;

So I suspect your syntax is probably not correct.

Sven Barth

2020-07-18 16:38

manager   ~0124144

Custom attributes are currently only supported for types as well as published properties of classes. Support for anything else first requires support for Extended RTTI.

Issue History

Date Modified Username Field Change
2020-07-18 11:40 Hafedh TRIMECHE New Issue
2020-07-18 11:59 Thaddy de Koning Note Added: 0124142
2020-07-18 12:01 Thaddy de Koning Note Edited: 0124142 View Revisions
2020-07-18 16:38 Sven Barth Note Added: 0124144
2020-07-18 16:38 Sven Barth Status new => acknowledged
2020-07-18 16:38 Sven Barth FPCTarget => -
2020-07-18 16:38 Sven Barth Severity minor => feature