diff options
Diffstat (limited to 'tests')
35 files changed, 822 insertions, 8 deletions
diff --git a/tests/Makefile b/tests/Makefile index 5fca581d3f..df1d180d00 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -2444,10 +2444,10 @@ ifndef SINGLEDOTESTRUNS endif alltests: alltest alltbs alltbf allwebtbs allwebtbf test_c_objects: testprep - $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcalext*.pp))) - $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcalext*.pp))) - $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcppcl*.pp))) - $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcppcl*.pp))) + $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcalext*.pp)) + $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcalext*.pp)) + $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcppcl*.pp)) + $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcppcl*.pp)) ifdef SINGLEDOTESTRUNS .PHONY: allexectbs allexectbf allexecwebtbs allexecwebtbf allexectest allexectests allexectbs: $(addsuffix .tbslog, $(LOGFILES)) @@ -2561,6 +2561,11 @@ ifneq ($(SVNVERSION),) $(ECHOREDIR) svnpackagesrevision=$(SVN_PACKAGES_REV_STR) >> $(TEST_OUTPUTDIR)/dbdigest.cfg endif ifeq ($(OS_SOURCE),openbsd) +ifeq ($(TARPROG),$(subst gtar,,$(TARPROG))) + BSD_SYSTEM_TAR=1 +endif +endif +ifdef BSD_SYSTEM_TAR TARFROM=-I tar.lst else TARFROM=--files-from=tar.lst diff --git a/tests/Makefile.fpc b/tests/Makefile.fpc index 7a23ec6ff0..eb88d1eeab 100644 --- a/tests/Makefile.fpc +++ b/tests/Makefile.fpc @@ -451,10 +451,10 @@ endif alltests: alltest alltbs alltbf allwebtbs allwebtbf test_c_objects: testprep - $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcalext*.pp))) - $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcalext*.pp))) - $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcppcl*.pp))) - $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcppcl*.pp))) + $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcalext*.pp)) + $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcalext*.pp)) + $(MAKE) $(patsubst %.pp,%.log, $(wildcard test/cg/cdecl/tcppcl*.pp)) + $(MAKE) $(patsubst %.pp,%.elg, $(wildcard test/cg/cdecl/tcppcl*.pp)) ################################ # Compile and Run tests @@ -647,6 +647,12 @@ endif # OpenBSD system tar executable doesn't know # about --files-from option, but supports -I ifeq ($(OS_SOURCE),openbsd) +ifeq ($(TARPROG),$(subst gtar,,$(TARPROG))) + BSD_SYSTEM_TAR=1 +endif +endif + +ifdef BSD_SYSTEM_TAR TARFROM=-I tar.lst else TARFROM=--files-from=tar.lst diff --git a/tests/test/cg/tcalext6.pp b/tests/test/cg/tcalext6.pp index 93b2375037..f162d3e3bf 100644 --- a/tests/test/cg/tcalext6.pp +++ b/tests/test/cg/tcalext6.pp @@ -28,9 +28,22 @@ uses ctypes; {$if defined(CPUARMEL) and defined(FPUSOFT)} { for softfloat calls in the C code } + {$define LIBGCC_NEEDED} +{$endif} + +{$ifdef OPENBSD} + { OpenBSD GCC uses __guard_local which is defined in crtbegin.o or crtbeginS.o} + {$define LIBC_NEEDED} +{$endif} + +{$ifdef LIBGCC_NEEDED} {$linklib gcc} {$endif} +{$ifdef LIBC_NEEDED} +{$linklib c} +{$endif} + type int8_t = shortint; pint8_t = ^int8_t; diff --git a/tests/test/cg/tcppcl2.pp b/tests/test/cg/tcppcl2.pp index 69db22fbbb..7726dd8059 100644 --- a/tests/test/cg/tcppcl2.pp +++ b/tests/test/cg/tcppcl2.pp @@ -4,6 +4,10 @@ program tcppcl2; {$mode objfpc} {$L cpptcl2.o} +{$ifdef openbsd} + {$linklib stdc++} + {$linklib c} +{$endif} type TestClass = cppclass external diff --git a/tests/test/tcasecov1.pp b/tests/test/tcasecov1.pp new file mode 100644 index 0000000000..5ada1dbdc0 --- /dev/null +++ b/tests/test/tcasecov1.pp @@ -0,0 +1,11 @@ +{ %fail } +{$mode iso} + +var + l: longint; +begin + l:=1; + case l of + 2: writeln; + end; +end. diff --git a/tests/test/tcasecov2.pp b/tests/test/tcasecov2.pp new file mode 100644 index 0000000000..14e68f6f47 --- /dev/null +++ b/tests/test/tcasecov2.pp @@ -0,0 +1,12 @@ +{ %fail } +{ %opt=-Sew } +{$mode extendedpascal} + +var + l: longint; +begin + l:=1; + case l of + 2: writeln; + end; +end. diff --git a/tests/test/tcasecov3.pp b/tests/test/tcasecov3.pp new file mode 100755 index 0000000000..29f14012f1 --- /dev/null +++ b/tests/test/tcasecov3.pp @@ -0,0 +1,11 @@ +{ %result=201 } +{$mode extendedpascal} + +var + l: longint; +begin + l:=1; + case l of + 2: writeln; + end; +end. diff --git a/tests/test/tcasecov4.pp b/tests/test/tcasecov4.pp new file mode 100755 index 0000000000..4afec810de --- /dev/null +++ b/tests/test/tcasecov4.pp @@ -0,0 +1,11 @@ +{ %opt=-Sew } +{ %norun } + +var + l: longint; +begin + l:=1; + case l of + 2: writeln; + end; +end. diff --git a/tests/test/tcasecov5.pp b/tests/test/tcasecov5.pp new file mode 100755 index 0000000000..e7b3135464 --- /dev/null +++ b/tests/test/tcasecov5.pp @@ -0,0 +1,12 @@ +{ %opt=-Sew } +{ %norun } + +{ should not print a warning } +var + l: qword; +begin + l:=1; + case l of + 2: writeln; + end; +end. diff --git a/tests/test/tcasecov6.pp b/tests/test/tcasecov6.pp new file mode 100755 index 0000000000..b022cb0805 --- /dev/null +++ b/tests/test/tcasecov6.pp @@ -0,0 +1,12 @@ +{ %fail } +{ %opt=-Sew } +{ %norun } + +var + l: 0..3; +begin + l:=1; + case l of + 2: writeln; + end; +end. diff --git a/tests/test/tcasecov7.pp b/tests/test/tcasecov7.pp new file mode 100755 index 0000000000..9fedb11c1e --- /dev/null +++ b/tests/test/tcasecov7.pp @@ -0,0 +1,11 @@ +{ %opt=-Sew } +{ %norun } + +var + s: shortstring; +begin + s:='abc'; + case s[1] of + 'b': writeln; + end; +end. diff --git a/tests/test/tcasecov8.pp b/tests/test/tcasecov8.pp new file mode 100755 index 0000000000..8ebff02afb --- /dev/null +++ b/tests/test/tcasecov8.pp @@ -0,0 +1,13 @@ +{ %opt=-Sew } +{ %norun } + +const + OT_SIZE_MASK = $3000001F; +var + l: longint; +begin + l:=1; + case l and OT_SIZE_MASK of + 1: writeln; + end; +end. diff --git a/tests/test/tcasecov9.pp b/tests/test/tcasecov9.pp new file mode 100755 index 0000000000..2f641a410d --- /dev/null +++ b/tests/test/tcasecov9.pp @@ -0,0 +1,15 @@ +{ %fail } +{ %opt=-Sew } +{ %norun } + +var + l: 0..1; +begin + l:=1; + case l of + 0: write('a'); + 1: writeln; + else + writeln('unreachable'); + end; +end. diff --git a/tests/test/tmshlp1.pp b/tests/test/tmshlp1.pp new file mode 100644 index 0000000000..a92134ea5f --- /dev/null +++ b/tests/test/tmshlp1.pp @@ -0,0 +1,38 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp1; + +type + TMyObject = class + procedure DoThis_1; + end; + THelper1 = class helper for TMyObject + procedure DoThis_2; + end; + THelper2 = class helper for TMyObject + procedure DoThis_3; + end; + +procedure TMyObject.DoThis_1; +begin +end; + +procedure THelper1.DoThis_2; +begin +end; + +procedure THelper2.DoThis_3; +begin +end; + +var + obj: TMyObject; +begin + obj := TMyObject.Create; + obj.DoThis_1; + obj.DoThis_2; + obj.DoThis_3; +end. diff --git a/tests/test/tmshlp10.pp b/tests/test/tmshlp10.pp new file mode 100644 index 0000000000..638187c23f --- /dev/null +++ b/tests/test/tmshlp10.pp @@ -0,0 +1,38 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp10; + +type + TMyObject = class + procedure DoThis(param: integer); overload; + end; + THelper1 = class helper for TMyObject + procedure DoThis(param: string); overload; + end; + THelper2 = class helper for TMyObject + procedure DoThis(param: pointer); overload; + end; + +procedure TMyObject.DoThis(param: integer); +begin +end; + +procedure THelper1.DoThis(param: string); +begin +end; + +procedure THelper2.DoThis(param: pointer); +begin +end; + +var + obj: TMyObject; +begin + obj := TMyObject.Create; + obj.DoThis(1); + obj.DoThis('string'); + obj.DoThis(nil); +end. diff --git a/tests/test/tmshlp11.pp b/tests/test/tmshlp11.pp new file mode 100644 index 0000000000..cdee6bfaba --- /dev/null +++ b/tests/test/tmshlp11.pp @@ -0,0 +1,40 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp11; + +type + TMyObject = class + class function Create1: TMyObject; + end; + THelper1 = class helper for TMyObject + class function Create2: TMyObject; + end; + THelper2 = class helper for TMyObject + class function Create3: TMyObject; + end; + +class function TMyObject.Create1: TMyObject; +begin + result := TMyObject.Create; +end; + +class function THelper1.Create2: TMyObject; +begin + result := TMyObject.Create; +end; + +class function THelper2.Create3: TMyObject; +begin + result := TMyObject.Create; +end; + +var + obj: TMyObject; +begin + obj := TMyObject.Create1; + obj := TMyObject.Create2; + obj := TMyObject.Create3; +end. diff --git a/tests/test/tmshlp12.pp b/tests/test/tmshlp12.pp new file mode 100644 index 0000000000..6483db996f --- /dev/null +++ b/tests/test/tmshlp12.pp @@ -0,0 +1,43 @@ +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp12; + +type + TMyObject = class + procedure DoThis; + end; + THelper1 = class helper for TMyObject + procedure DoThis; + end; + THelper2 = class helper for TMyObject + procedure DoThis; + end; + +var + Res: integer; + +procedure TMyObject.DoThis; +begin + Res := 1; +end; + +procedure THelper1.DoThis; +begin + Res := 2; +end; + +procedure THelper2.DoThis; +begin + Res := 3; +end; + +var + obj: TMyObject; +begin + obj := TMyObject.Create; + obj.DoThis; + writeln(Res); + if Res <> 3 then + Halt(1); +end. diff --git a/tests/test/tmshlp13.pp b/tests/test/tmshlp13.pp new file mode 100644 index 0000000000..0640a53e84 --- /dev/null +++ b/tests/test/tmshlp13.pp @@ -0,0 +1,19 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp13; + +type + THelper1 = class helper for TObject + class var field1: integer; + end; + THelper2 = class helper for TObject + class var field2: integer; + end; + +begin + TObject.field1 := 1; + TObject.field2 := 2; +end. diff --git a/tests/test/tmshlp14.pp b/tests/test/tmshlp14.pp new file mode 100644 index 0000000000..6b2be29833 --- /dev/null +++ b/tests/test/tmshlp14.pp @@ -0,0 +1,21 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp14; + +type + THelper1 = class helper for TObject + type TInteger = integer; + end; + THelper2 = class helper for TObject + type TString = string; + end; + +var + obj: TObject; +begin + writeln(sizeof(TObject.TInteger)); + writeln(sizeof(TObject.TString)); +end. diff --git a/tests/test/tmshlp15.pp b/tests/test/tmshlp15.pp new file mode 100644 index 0000000000..c315da412e --- /dev/null +++ b/tests/test/tmshlp15.pp @@ -0,0 +1,14 @@ +program tmshlp15; + +{$mode objfpc} +{$modeswitch multihelpers} + +uses + umshlp15a, umshlp15b; + +var + o: TObject; +begin + if o.Test <> 2 then + Halt(1); +end. diff --git a/tests/test/tmshlp16.pp b/tests/test/tmshlp16.pp new file mode 100644 index 0000000000..acce4ab023 --- /dev/null +++ b/tests/test/tmshlp16.pp @@ -0,0 +1,14 @@ +program tmshlp16; + +{$mode objfpc} +{$modeswitch multihelpers} + +uses + umshlp15b, umshlp15a; + +var + o: TObject; +begin + if o.Test <> 1 then + Halt(1); +end. diff --git a/tests/test/tmshlp2.pp b/tests/test/tmshlp2.pp new file mode 100644 index 0000000000..fba1262fe1 --- /dev/null +++ b/tests/test/tmshlp2.pp @@ -0,0 +1,38 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch advancedrecords} +{$modeswitch multihelpers} + +program tmshlp2; + +type + TMyObject = record + procedure DoThis_1; + end; + THelper1 = record helper for TMyObject + procedure DoThis_2; + end; + THelper2 = record helper for TMyObject + procedure DoThis_3; + end; + +procedure TMyObject.DoThis_1; +begin +end; + +procedure THelper1.DoThis_2; +begin +end; + +procedure THelper2.DoThis_3; +begin +end; + +var + obj: TMyObject; +begin + obj.DoThis_1; + obj.DoThis_2; + obj.DoThis_3; +end. diff --git a/tests/test/tmshlp3.pp b/tests/test/tmshlp3.pp new file mode 100644 index 0000000000..ca030de79c --- /dev/null +++ b/tests/test/tmshlp3.pp @@ -0,0 +1,32 @@ +{$mode objfpc} +{$modeswitch typehelpers} +{$modeswitch multihelpers} + +program tmshlp3; + +type + TStringHelper1 = type helper for String + function Length: integer; + end; + +function TStringHelper1.Length: integer; +begin + result := System.Length(self); +end; + +type + TStringHelper2 = type helper for string + function LengthSquared: integer; + end; + +function TStringHelper2.LengthSquared: integer; +begin + result := self.Length * self.Length; +end; + +var + s: string = 'abcd'; +begin + if (s.Length <> 4) or (s.LengthSquared <> 16 ) then + Halt(1); +end.
\ No newline at end of file diff --git a/tests/test/tmshlp4.pp b/tests/test/tmshlp4.pp new file mode 100644 index 0000000000..77dcbf43dd --- /dev/null +++ b/tests/test/tmshlp4.pp @@ -0,0 +1,50 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp4; + +type + TMyObject = class + procedure DoThis_1; + end; + THelperBase = class helper for TMyObject + procedure DoThis_4; + end; + THelper1 = class helper(THelperBase) for TMyObject + procedure DoThis_2; + end; + THelper2 = class helper(THelperBase) for TMyObject + procedure DoThis_3; + end; + +procedure THelperBase.DoThis_4; +begin + writeln('DoThis_4'); +end; + +procedure TMyObject.DoThis_1; +begin + writeln('DoThis_1'); +end; + +procedure THelper1.DoThis_2; +begin + writeln('DoThis_2'); +end; + +procedure THelper2.DoThis_3; +begin + writeln('DoThis_3'); +end; + +var + obj: TMyObject; +begin + obj := TMyObject.Create; + obj.DoThis_1; + obj.DoThis_2; + obj.DoThis_3; + obj.DoThis_4; +end. diff --git a/tests/test/tmshlp5.pp b/tests/test/tmshlp5.pp new file mode 100644 index 0000000000..ac8fd205d8 --- /dev/null +++ b/tests/test/tmshlp5.pp @@ -0,0 +1,37 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp5; + +type + TMyObject = class + constructor Create1; + end; + THelper1 = class helper for TMyObject + constructor Create2; + end; + THelper2 = class helper for TMyObject + constructor Create3; + end; + +constructor TMyObject.Create1; +begin +end; + +constructor THelper1.Create2; +begin +end; + +constructor THelper2.Create3; +begin +end; + +var + obj: TMyObject; +begin + obj := TMyObject.Create1; + obj := TMyObject.Create2; + obj := TMyObject.Create3; +end. diff --git a/tests/test/tmshlp6.pp b/tests/test/tmshlp6.pp new file mode 100644 index 0000000000..ea01d8e5cc --- /dev/null +++ b/tests/test/tmshlp6.pp @@ -0,0 +1,37 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp6; + +type + TMyObject = class + m_num: integer; + property num1: integer read m_num; + end; + THelperBase = class helper for TMyObject + function GetNum: integer; + end; + THelper1 = class helper(THelperBase) for TMyObject + property num2: integer read GetNum; + end; + THelper2 = class helper(THelperBase) for TMyObject + property num3: integer read GetNum; + end; + +function THelperBase.GetNum: integer; +begin + result := m_num; +end; + +var + obj: TMyObject; + num: integer; +begin + obj := TMyObject.Create; + // 2^3 + obj.m_num := 2; + num := obj.num1 * obj.num2 * obj.num3; + writeln(num); +end. diff --git a/tests/test/tmshlp7.pp b/tests/test/tmshlp7.pp new file mode 100644 index 0000000000..0bb12dabad --- /dev/null +++ b/tests/test/tmshlp7.pp @@ -0,0 +1,38 @@ +{ %NORUN } + +{$mode delphi} +{$modeswitch multihelpers} + +program tmshlp7; + +type + TMyObject = class + procedure DoThis_1; + end; + THelper1 = class helper for TMyObject + procedure DoThis_2; + end; + THelper2 = class helper for TMyObject + procedure DoThis_3; + end; + +procedure TMyObject.DoThis_1; +begin +end; + +procedure THelper1.DoThis_2; +begin +end; + +procedure THelper2.DoThis_3; +begin +end; + +var + obj: TMyObject; +begin + obj := TMyObject.Create; + obj.DoThis_1; + obj.DoThis_2; + obj.DoThis_3; +end. diff --git a/tests/test/tmshlp8.pp b/tests/test/tmshlp8.pp new file mode 100644 index 0000000000..5e2ac0cd70 --- /dev/null +++ b/tests/test/tmshlp8.pp @@ -0,0 +1,36 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch typehelpers} +{$modeswitch multihelpers} + +program tmshlp8; +uses + umshlp1; + +type + TClassHelper = class helper for TObject + procedure DoThis; + end; + TStringHelper = type helper for String + function Length: integer; + end; + +procedure TClassHelper.DoThis; +begin + DoThisExt; +end; + +function TStringHelper.Length: integer; +begin + result := LengthExt; +end; + +var + obj: TObject; + str: string; +begin + obj := TObject.Create; + obj.DoThis; + writeln(str.Length + str.LengthTimesTwo); +end. diff --git a/tests/test/tmshlp9.pp b/tests/test/tmshlp9.pp new file mode 100644 index 0000000000..6f86df6030 --- /dev/null +++ b/tests/test/tmshlp9.pp @@ -0,0 +1,38 @@ +{ %NORUN } + +{$mode objfpc} +{$modeswitch multihelpers} + +program tmshlp9; + +type + TMyObject = class + procedure DoThis_1; + end; + THelper1 = class helper for TMyObject + procedure DoThis_2; + end; + THelper2 = class helper for TMyObject + procedure DoThis_3; + end; + +procedure TMyObject.DoThis_1; +begin +end; + +procedure THelper1.DoThis_2; +begin + DoThis_1; +end; + +procedure THelper2.DoThis_3; +begin + DoThis_2; +end; + +var + obj: TMyObject; +begin + obj := TMyObject.Create; + obj.DoThis_3; +end. diff --git a/tests/test/tthlp27.pp b/tests/test/tthlp27.pp new file mode 100644 index 0000000000..425e7c98cc --- /dev/null +++ b/tests/test/tthlp27.pp @@ -0,0 +1,21 @@ +{ %FAIL } + +program tthlp27; + +{$mode delphi} + +type + TLongIntHelper = record helper for LongInt + procedure Test; + end; + +procedure TLongIntHelper.Test; +begin + +end; + +var + p: PLongInt; +begin + p.Test; +end. diff --git a/tests/test/tthlp28.pp b/tests/test/tthlp28.pp new file mode 100644 index 0000000000..4882904e84 --- /dev/null +++ b/tests/test/tthlp28.pp @@ -0,0 +1,21 @@ +{ %NORUN } + +program tthlp28; + +{$mode delphi} + +type + TPLongIntHelper = record helper for PLongInt + procedure Test; + end; + +procedure TPLongIntHelper.Test; +begin + +end; + +var + p: PLongInt; +begin + p.Test; +end. diff --git a/tests/test/umshlp1.pp b/tests/test/umshlp1.pp new file mode 100644 index 0000000000..29766816bb --- /dev/null +++ b/tests/test/umshlp1.pp @@ -0,0 +1,35 @@ +{$mode objfpc} +{$modeswitch advancedrecords} +{$modeswitch typehelpers} + +unit umshlp1; +interface + +type + TExtClassHelper = class helper for TObject + procedure DoThisExt; + end; + TExtStringHelper = type helper for String + function LengthExt: integer; + end; + TExtStringHelperMore = type helper for String + function LengthTimesTwo: integer; + end; + +implementation + +procedure TExtClassHelper.DoThisExt; +begin +end; + +function TExtStringHelper.LengthExt: integer; +begin + result := System.Length(self); +end; + +function TExtStringHelperMore.LengthTimesTwo: integer; +begin + result := System.Length(self) * 2; +end; + +end. diff --git a/tests/test/umshlp15a.pp b/tests/test/umshlp15a.pp new file mode 100644 index 0000000000..140dcf52f4 --- /dev/null +++ b/tests/test/umshlp15a.pp @@ -0,0 +1,19 @@ +unit umshlp15a; + +{$mode objfpc} + +interface + +type + THelperA = class helper for TObject + function Test: LongInt; + end; + +implementation + +function THelperA.Test: LongInt; +begin + Result := 1; +end; + +end. diff --git a/tests/test/umshlp15b.pp b/tests/test/umshlp15b.pp new file mode 100644 index 0000000000..125c8e1062 --- /dev/null +++ b/tests/test/umshlp15b.pp @@ -0,0 +1,19 @@ +unit umshlp15b; + +{$mode objfpc} + +interface + +type + THelperB = class helper for TObject + function Test: LongInt; + end; + +implementation + +function THelperB.Test: LongInt; +begin + Result := 2; +end; + +end. diff --git a/tests/webtbs/tw35533.pp b/tests/webtbs/tw35533.pp new file mode 100644 index 0000000000..04e8b167ce --- /dev/null +++ b/tests/webtbs/tw35533.pp @@ -0,0 +1,30 @@ +{ %NORUN } + +program tw35533; +{$mode delphiunicode} + +type + TPointerHelper = record helper for pointer + function AsNativeUint: nativeuint; + function PCharLen: uint32; + end; + +function TPointerHelper.AsNativeUint: nativeuint; +begin + Result := nativeuint(self); +end; + +function TPointerHelper.PCharLen: uint32; +begin + Result := 5; //- Just here to illustrate the issue. +end; + +var + P: pointer; + +begin + P := @ParamStr(0); //- Just a nonsense pointer. + Writeln( P.AsNativeUInt ); + Writeln( P.PCharLen ); + Readln; +end. |