@@ -8238,6 +8238,8 @@ tests/test/tforin17.pp svneol=native#text/pascal
tests/test/tforin18.pp svneol=native#text/pascal
tests/test/tforin19.pp svneol=native#text/pascal
tests/test/tforin2.pp svneol=native#text/pascal
+tests/test/tforin20.pp svneol=native#text/pascal
+tests/test/tforin21.pp svneol=native#text/pascal
tests/test/tforin3.pp svneol=native#text/pascal
tests/test/tforin4.pp svneol=native#text/pascal
tests/test/tforin5.pp svneol=native#text/pascal
@@ -425,16 +425,8 @@ implementation
{ enumerator is a special case too }
if optoken=_OP_ENUMERATOR then
begin
- //eq:=check_that_return_type_is_ok_for_enumerator;
result:=
- { don't allow overloading assigning to custom shortstring
- types, because we also don't want to differentiate based
- on different shortstring types (e.g.,
- "operator :=(const v: variant) res: shorstring" also
- has to work for assigning a variant to a string[80])
- }
- (not is_shortstring(pf.returndef) or
- (tstringdef(pf.returndef).len=255));
+ is_class_or_interface_or_object(pf.returndef);
end
else
@@ -4286,7 +4286,7 @@ implementation
pd := tprocdef(Tprocsym(sym).ProcdefList[i]);
if (pd.proctypeoption = potype_function) and
- (pd.returndef.typ = objectdef) and
+ is_class_or_interface_or_object(pd.returndef) and
(pd.visibility >= vis_public) then
result:=pd;
@@ -813,7 +813,8 @@ implementation
inc(realparamcount);
if (paraidx<pd.paras.count) and
assigned(pd.paras[paraidx]) and
- (realparamcount = 1) then
+ (realparamcount = 1) and
+ is_class_or_interface_or_object(pd.returndef) then
eq:=compare_defs_ext(typedef,tparavarsym(pd.paras[paraidx]).vardef,nothingn,convtyp,hpd,[]);
@@ -0,0 +1,8 @@
+{$mode objfpc}
+{$apptype console}
+type T = (a1, b1=5);
+var
+ ch: T;
+begin
+ for ch in T do Writeln(ch);
+end.
@@ -0,0 +1,14 @@
+{ %FAIL}
+
+operator enumerator(a: Integer): Integer;
+ Result := 0;
+end;
+ i: Integer;
+ for i in 1 do Writeln(i);