Delphi mode accepts property attributes with empty constructor parameters even if it is not available
## Summary In `{$mode delphi}` compiler allows to declare a property attribute without parameters even if the parameterless constructor is not available. The attribute doesn't get created, though. ```pascal {$mode delphi} {$ModeSwitch prefixedattributes} MyAttr = class(TCustomAttribute) public constructor Create(const A: Boolean); end; TMyObj = class published [MyAttr] // no error property Prop1: string read fProp1 write fProp1; end; ``` ## System Information - **Operating system:** Windows - **Processor architecture:** x86 - **Compiler version:** trunk - **Device:** Computer ## Example Project ```pascal program DelphiAttrCreate; {$mode delphi} {$ModeSwitch prefixedattributes} uses Classes, TypInfo; type MyAttr = class(TCustomAttribute) public constructor Create(const A: Boolean); end; TMyObj = class private fProp1: string; published [MyAttr] property Prop1: string read fProp1 write fProp1; end; { MyAttr } constructor MyAttr.Create(const A: Boolean); begin end; var O: TMyObj; TypeData: TTypeData; PropList: PPropList; PropInfo: PPropInfo; I, A: Integer; Attribute: TCustomAttribute; AttrFound: array of TClass; begin AttrFound := nil; O := TMyObj.Create; TypeData := GetTypeData(O.ClassInfo)^; if TypeData.PropCount>0 then begin GetMem(PropList, TypeData.PropCount*SizeOf(Pointer)); GetPropInfos(O.ClassInfo, PropList); for I := 0 to TypeData.PropCount-1 do begin PropInfo := PropList^[I]; if Assigned(PropInfo.AttributeTable) then begin for A := 0 to PropInfo.AttributeTable^.AttributeCount-1 do begin Attribute := PropInfo.AttributeTable^.AttributesList[I].AttrProc; // Writeln(Attribute.ClassName); AttrFound := AttrFound + [Attribute.ClassType]; Attribute.Free; end; end; end; FreeMem(PropList, TypeData.PropCount*SizeOf(Pointer)); end; if not((Length(AttrFound)=1) and (AttrFound[0]=MyAttr.ClassType)) then Halt(1); end. ``` ## What is the current bug behavior? No compiler error, the attribute is silently ignored. ## What is the expected (correct) behavior? A compiler error like in `{$mode objfpc}` (or Delphi itself): ``` DelphiAttrCreate.lpr(19,12) Error: Wrong number of parameters specified for call to "Create" ```
issue