View Issue Details

IDProjectCategoryView StatusLast Update
0035866FPCCompilerpublic2019-07-20 19:49
ReporterThaddy de Koning Assigned ToSven Barth  
Status resolvedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0035866: Attributes: Internal error 2019070601
DescriptionWhile testing the new attributes feature I ran into Internal error 2019070601
There maybe something wrong with my assumptions (see code below) since I am not yet experienced enough with this feature, but it should not throw an internal error.
Steps To Reproduceprogram testattributes;
{$mode delphi}{$warn 5079 off} // turn warning experimental off
  sysutils, dateutils, typinfo, rtti, classes;
   TDateTimeAttribute = class(TCustomAttribute)
     constructor Create(aArg: String);overload;
     constructor Create(aArg: TDateTime);overload;
     constructor Create(aArg: int64);overload;
     property DateTime:TDateTime read Farg;
   TMyDateTimeClass = class
     property DateTime:TDateTime;

   constructor TDateTimeAttribute.Create(aArg: String);
     inherited create;
     FArg := StrToDateTime(aArg);
   constructor TDateTimeAttribute.Create(aArg: TDateTime);
     FArg := aArg;
   constructor TDateTimeAttribute.Create(aArg: int64);
     FArg := UnixToDateTime(aArg);
  Test := TMyDateTimeClass.Create;
Additional InformationI was trying to unify datetime initialization.
TagsNo tags attached.
Fixed in Revision42469
Attached Files


Sven Barth

2019-07-20 19:49

manager   ~0117331

Multiple points:
- main problem: the arguments for an attribute *must* be constant expressions (though I thought the compiler would check this already the way I implemented it, but seems that I was wrong; this is fixed now)
- something I noticed only now when checking with Delphi: if you want to use an attribute without any arguments then you *must* declare a parameterless constructor yourself (I have yet to fix this)
- you missed a "read FDateTime" in the declaration of TMyDateTimeClass.DateTime

Issue History

Date Modified Username Field Change
2019-07-20 17:55 Thaddy de Koning New Issue
2019-07-20 19:49 Sven Barth Assigned To => Sven Barth
2019-07-20 19:49 Sven Barth Status new => resolved
2019-07-20 19:49 Sven Barth Resolution open => fixed
2019-07-20 19:49 Sven Barth Fixed in Version => 3.3.1
2019-07-20 19:49 Sven Barth Fixed in Revision => 42469
2019-07-20 19:49 Sven Barth FPCTarget => -
2019-07-20 19:49 Sven Barth Note Added: 0117331