Browse Source

* fixed mantis #6152 (allow overloads to be defined before all
forwarddefs have been implemented)

git-svn-id: trunk@5995 -

Jonas Maebe 18 years ago
parent
commit
bc06fd4d74
3 changed files with 32 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 5 1
      compiler/psub.pas
  3. 26 0
      tests/webtbs/tw4229a.pp

+ 1 - 0
.gitattributes

@@ -7800,6 +7800,7 @@ tests/webtbs/tw4215.pp svneol=native#text/plain
 tests/webtbs/tw4219.pp svneol=native#text/plain
 tests/webtbs/tw4223.pp svneol=native#text/plain
 tests/webtbs/tw4229.pp -text svneol=unset#text/plain
+tests/webtbs/tw4229a.pp svneol=native#text/plain
 tests/webtbs/tw4233.pp svneol=native#text/plain
 tests/webtbs/tw4234.pp svneol=native#text/plain
 tests/webtbs/tw4234a.pp svneol=native#text/plain

+ 5 - 1
compiler/psub.pas

@@ -1496,7 +1496,11 @@ implementation
                    (tprocsym(pd.procsym).ProcdefList.Count>1) and
                    firstpd.forwarddef and
                    firstpd.interfacedef and
-                   not(tprocsym(pd.procsym).ProcdefList.Count>2) then
+                   not(tprocsym(pd.procsym).ProcdefList.Count>2) and
+                   { don't give an error if it may be an overload }
+                   not(m_fpc in current_settings.modeswitches) and
+                   (not(po_overload in pd.procoptions) or
+                    not(po_overload in firstpd.procoptions)) then
                  begin
                    MessagePos1(pd.fileinfo,parser_e_header_dont_match_forward,pd.fullprocname(false));
                    tprocsym(pd.procsym).write_parameter_lists(pd);

+ 26 - 0
tests/webtbs/tw4229a.pp

@@ -0,0 +1,26 @@
+{ %fail }
+{ %norun}
+{ Source provided for Free Pascal Bug Report 4229 }
+{ Submitted by "Gerhard" on  2005-07-28 }
+{ e-mail: [email protected] }
+unit tw4229a ;
+
+interface
+
+  type
+    strobj = object
+               bs : string ;
+               ba : ansistring ;
+              end ;
+
+  operator := ( const a : ansistring ) z : strobj ;
+
+implementation
+
+  operator := ( const s : string ) z : strobj ;
+
+    begin
+      z.bs := s ;
+     end ;
+
+end.