Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Generics    [ Add a report in this area ]  
Report #:  120801   Status: Closed
E2426 for asm function in Generic class
Project:  Delphi Build #:  19.0.13856.4978
Version:    19.0 Submitted By:   Markus -
Report Type:  Basic functionality failure Date Reported:  11/27/2013 1:27:37 AM
Severity:    Serious / Highly visible problem Last Updated: 4/15/2014 6:37:23 PM
Platform:    All versions Internal Tracking #:   45573
Resolution: Duplicate (Resolution Comments) Resolved in Build: : XE6
Duplicate of:  120209
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
Description
I get the compiler error when compiling the following code.
-------
[dcc32 Error] Project1.dpr(19): E2426 Inline function must not have asm block
-------

The error does not make sense here because the related function is no inline function.

Possible solutions:
* EITHER Change the compiler error text to a more meaningful description (if this is desired behavior). In this case it should be documented somehow that generic classes mustn't have inline functions, I did not find this information anywere.
* OR make the code compile.
Steps to Reproduce:
---------
program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils;

type
  TFoo<T> = class(TObject)
    procedure Bar;
  end;

{ TFoo<T> }
procedure TFoo<T>.Bar;
asm
  xor eax,eax
end; // <<---- [dcc32 Error] E2426 Inline function must not have asm block

var
  MyInstance: TFoo<integer>;
begin
  try
    MyInstance := TFoo<integer>.Create;
    MyInstance.Bar;
    MyInstance.Free;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.
---------
Workarounds
None
Attachment
None
Comments

Asbjørn Heid at 1/18/2014 1:17:07 PM -
This is a duplicate of QC report# 120209.

Server Response from: ETNACODE01