fpc/tests/webtbs/tw24651.pp
svenbarth fc79d47b09 Fix for Mantis #24651. Allow pointer comparison for internal expressions (in this case check for valid VMT).
nadd.pas, taddnode:
  + add new constructor "create_internal" which adds "nf_internal" to the node's "flags"
  * pass_typecheck_internal: allow pointer comparisons other than "=" and "<>" for nodes which have "nf_internal" set
psub.pas, generate_bodyentry_block:
  * create the addnode using "create_internal" instead of "create" to allow the pointer comparison

+ added test 

git-svn-id: trunk@25069 -
2013-07-09 08:04:11 +00:00

48 lines
685 B
ObjectPascal

{ %NORUN }
program tw24651;
//{$mode delphi}{$H+}
{$modeswitch class}
{$A+}
{$B-}
{$I+}
{$X-}
uses
Classes
{ you can add units after this };
type
o_Class1 = class
fString1 : string ;
constructor Create ;
end ;
o_Class2 = class (o_Class1)
fString2 : string ;
constructor Create (aStr : string) ;
end ;
constructor o_Class1.Create ;
//var t_o : pointer ;
begin
{t_o := }inherited Create ;
fString1 := 'test value'
end ;
constructor o_Class2.Create (aStr : string) ;
//var c_1 : pointer;
begin
{c_1 := }inherited Create ;
fstring2 := aStr
end ;
var
C2 : o_Class2 ;
begin
C2 := o_Class2.Create ('test param') ;
WriteLn (C2.fString1)
end.