mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 05:59:28 +02:00

Please note that this warning won't be triggered if an instance of that class is created using a class variable of that class type as the compiler can not know the type contained in the variable at compile time (see also the added test). + msg/errore.msg: added disabled message which informs about the instantiation of an abstract class * pexpr.pas, do_member_read: generate the message if we have a constructor call for an abstract class using a loadvmtaddrnode (thus the type name is used and not a class variable) * msg{idx,txt}.inc: updated + added test git-svn-id: trunk@28127 -
31 lines
366 B
ObjectPascal
31 lines
366 B
ObjectPascal
{ %FAIL }
|
|
|
|
program tb0247;
|
|
|
|
{$WARN 4122 ERROR}
|
|
|
|
{$mode objfpc}
|
|
|
|
type
|
|
TTest = class abstract
|
|
|
|
end;
|
|
|
|
TTestClass = class of TTest;
|
|
|
|
TTestSub = class
|
|
|
|
end;
|
|
|
|
var
|
|
o: TObject;
|
|
c: TTestClass;
|
|
begin
|
|
{ this should not create an error }
|
|
o := c.Create;
|
|
{ this neither }
|
|
o := TTestSub.Create;
|
|
{ but this should create an error }
|
|
o := TTest.Create;
|
|
end.
|