I see the same behavior for both Records and Classes, but on XE8
Code:
type
TMyClass = class
constructor Create; overload;
function CreateEx(Value: string): string; overload;
class function Create(Value: Integer): Integer; overload;
class function CreateEx(Value: Integer): Integer; overload;
procedure InternalTest;
end;
TMyRec = record
constructor Create(Value: string); overload;
function CreateEx(Value: string): string; overload;
class function Create(Value: Integer): Integer; overload; static;
class function CreateEx(Value: Integer): Integer; overload; static;
procedure InternalTest;
end;
{ TMyClass }
constructor TMyClass.Create;
begin
end;
class function TMyClass.Create(Value: Integer): Integer;
begin
Result := Value;
end;
function TMyClass.CreateEx(Value: string): string;
begin
Result := Value;
end;
class function TMyClass.CreateEx(Value: Integer): Integer;
begin
Result := Value;
end;
procedure TMyClass.InternalTest;
begin
//Create(5); // [dcc32 Error] Project5.dpr(54): E2382 Cannot call constructors using instance variables
CreateEx(5); // Compile Fine
end;
{ TMyRec }
class function TMyRec.Create(Value: Integer): Integer;
begin
Result := Value;
end;
constructor TMyRec.Create(Value: string);
begin
end;
class function TMyRec.CreateEx(Value: Integer): Integer;
begin
Result := Value;
end;
function TMyRec.CreateEx(Value: string): string;
begin
Result := Value;
end;
procedure TMyRec.InternalTest;
begin
//Create(5); // [dcc32 Error] Project5.dpr(81): E2382 Cannot call constructors using instance variables
CreateEx(5); // Compile Fine
end;