mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 12:59:29 +01:00 
			
		
		
		
	+ globtype.pas: add new modeswitch to modeswitch enum and name array * ptype.pas & pdecobj.pas: check for new modeswitch instead of modeswitch class * ppu.pas: increase ppu version as we've added a new modeswitch which requires correctly compiled units * adjusted tests to enabled the modeswitch when necessary + added three new tests that check for correct functionality of modeswitch typehelpers git-svn-id: trunk@26796 -
		
			
				
	
	
		
			39 lines
		
	
	
		
			676 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			676 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
{ this tests that class methods can be used in type helpers }
 | 
						|
 | 
						|
program tthlp9;
 | 
						|
 | 
						|
{$mode objfpc}
 | 
						|
{$modeswitch typehelpers}
 | 
						|
{$apptype console}
 | 
						|
 | 
						|
type
 | 
						|
  TInt32Helper = type helper for Int32
 | 
						|
    class function Test: LongInt; static;
 | 
						|
  end;
 | 
						|
 | 
						|
  TShortStringHelper = type helper for ShortString
 | 
						|
    class function Test: LongInt; static;
 | 
						|
  end;
 | 
						|
 | 
						|
class function TInt32Helper.Test: LongInt;
 | 
						|
begin
 | 
						|
  Result := SizeOf(Int32);
 | 
						|
end;
 | 
						|
 | 
						|
class function TShortStringHelper.Test: LongInt;
 | 
						|
begin
 | 
						|
  Result := SizeOf(AnsiChar);
 | 
						|
end;
 | 
						|
 | 
						|
var
 | 
						|
  i: LongInt;
 | 
						|
begin
 | 
						|
  if LongInt.Test <> 4 then
 | 
						|
    Halt(1);
 | 
						|
  if i.Test <> 4 then
 | 
						|
    Halt(2);
 | 
						|
  if ShortString.Test <> 1 then
 | 
						|
    Halt(3);
 | 
						|
  Writeln('OK');
 | 
						|
end.
 |