mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 01:19:38 +01:00 
			
		
		
		
	* now that copy() expressions are only translated into calls during the
first pass, we have to manually set the varstate of its parameters during
    the typecheck pass (mantis #21878)
git-svn-id: trunk@21106 -
			
			
This commit is contained in:
		
							parent
							
								
									be5a5d6ae6
								
							
						
					
					
						commit
						562b968b16
					
				
							
								
								
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							@ -12567,6 +12567,7 @@ tests/webtbs/tw2178.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw2185.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw2186.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw2187.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw21878.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw2196.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw2197.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw2198.pp svneol=native#text/plain
 | 
			
		||||
 | 
			
		||||
@ -1599,8 +1599,10 @@ implementation
 | 
			
		||||
        while assigned(ppn.right) do
 | 
			
		||||
         begin
 | 
			
		||||
           inc(counter);
 | 
			
		||||
           set_varstate(ppn.left,vs_read,[vsf_must_be_valid]);
 | 
			
		||||
           ppn:=tcallparanode(ppn.right);
 | 
			
		||||
         end;
 | 
			
		||||
        set_varstate(ppn.left,vs_read,[vsf_must_be_valid]);
 | 
			
		||||
        paradef:=ppn.left.resultdef;
 | 
			
		||||
        if is_ansistring(paradef) then
 | 
			
		||||
          // set resultdef to argument def
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										23
									
								
								tests/webtbs/tw21878.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								tests/webtbs/tw21878.pp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
{ %norun }
 | 
			
		||||
{ %opt=-vn -Sen }
 | 
			
		||||
 | 
			
		||||
{$mode objfpc}{$H+}
 | 
			
		||||
 | 
			
		||||
uses
 | 
			
		||||
  Classes, SysUtils;
 | 
			
		||||
 | 
			
		||||
function DoSomething(const AName: string): integer;
 | 
			
		||||
var
 | 
			
		||||
  i, l: Integer;
 | 
			
		||||
begin
 | 
			
		||||
  Result := 0;;
 | 
			
		||||
  l := Length(AName);
 | 
			
		||||
  for i:= 1 to Paramcount do begin
 | 
			
		||||
    if copy(ParamStr(i),1, l) = AName then
 | 
			
		||||
      inc(Result);
 | 
			
		||||
  end;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
  DoSomething('a');
 | 
			
		||||
end.
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user