Browse Source

* accept undefineddef (generic parameter) as parameter for assigned, resolves #19974

git-svn-id: trunk@18183 -
florian 14 years ago
parent
commit
8b58d69576
3 changed files with 32 additions and 4 deletions
  1. 1 0
      .gitattributes
  2. 5 4
      compiler/pexpr.pas
  3. 26 0
      tests/webtbs/tw19974.pp

+ 1 - 0
.gitattributes

@@ -11719,6 +11719,7 @@ tests/webtbs/tw1964.pp svneol=native#text/plain
 tests/webtbs/tw19700.pp svneol=native#text/plain
 tests/webtbs/tw19864.pp svneol=native#text/pascal
 tests/webtbs/tw1996.pp svneol=native#text/plain
+tests/webtbs/tw19974.pp svneol=native#text/pascal
 tests/webtbs/tw2001.pp svneol=native#text/plain
 tests/webtbs/tw2002.pp svneol=native#text/plain
 tests/webtbs/tw2004.pp svneol=native#text/plain

+ 5 - 4
compiler/pexpr.pas

@@ -515,10 +515,11 @@ implementation
                          err:=true;
                        end;
                    else
-                     begin
-                       Message(parser_e_illegal_parameter_list);
-                       err:=true;
-                     end;
+                     if p1.resultdef.typ<>undefineddef then
+                       begin
+                         Message(parser_e_illegal_parameter_list);
+                         err:=true;
+                       end;
                  end;
                end
               else

+ 26 - 0
tests/webtbs/tw19974.pp

@@ -0,0 +1,26 @@
+program uGenAss;
+
+{$mode objfpc}{$H+}
+
+uses
+  Classes, SysUtils;
+
+type
+  generic TGeneric<T> = class
+  public
+    function Find(AObject: T): T;
+  end;
+
+function TGeneric.Find(AObject: T): T;
+var
+  tt: T;
+begin
+  if tt <> nil then;
+  if AObject <> nil then;
+
+  if Assigned(tt) then;
+  if Assigned(AObject) then;
+end;
+
+begin
+end.