diff --git a/.gitattributes b/.gitattributes index a3b89f84b5..d8eae300b6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13594,6 +13594,7 @@ tests/webtbs/tw25054a.pp svneol=native#text/pascal tests/webtbs/tw25054b.pp svneol=native#text/pascal tests/webtbs/tw25059.pp svneol=native#text/pascal tests/webtbs/tw25077.pp svneol=native#text/pascal +tests/webtbs/tw25081.pp svneol=native#text/pascal tests/webtbs/tw2514.pp svneol=native#text/plain tests/webtbs/tw2525.pp svneol=native#text/plain tests/webtbs/tw2536.pp svneol=native#text/plain diff --git a/compiler/pparautl.pas b/compiler/pparautl.pas index 05efa02d1d..ecc323ccc2 100644 --- a/compiler/pparautl.pas +++ b/compiler/pparautl.pas @@ -265,15 +265,18 @@ implementation { insert the name of the procedure as alias for the function result, we can't use realname because that will not work for compilerprocs as the name is lowercase and unreachable from the code } - if assigned(pd.resultname) then - hs:=pd.resultname^ - else - hs:=pd.procsym.name; - sl:=tpropaccesslist.create; - sl.addsym(sl_load,pd.funcretsym); - aliasvs:=tabsolutevarsym.create_ref(hs,pd.returndef,sl); - include(aliasvs.varoptions,vo_is_funcret); - tlocalsymtable(pd.localst).insert(aliasvs); + if (pd.proctypeoption<>potype_operator) or assigned(pd.resultname) then + begin + if assigned(pd.resultname) then + hs:=pd.resultname^ + else + hs:=pd.procsym.name; + sl:=tpropaccesslist.create; + sl.addsym(sl_load,pd.funcretsym); + aliasvs:=tabsolutevarsym.create_ref(hs,pd.returndef,sl); + include(aliasvs.varoptions,vo_is_funcret); + tlocalsymtable(pd.localst).insert(aliasvs); + end; { insert result also if support is on } if (m_result in current_settings.modeswitches) then diff --git a/tests/webtbs/tw25081.pp b/tests/webtbs/tw25081.pp new file mode 100644 index 0000000000..40787937e1 --- /dev/null +++ b/tests/webtbs/tw25081.pp @@ -0,0 +1,55 @@ +program tw25081; + +{$APPTYPE CONSOLE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +type + TLargeCardinal = record + public + Low: Cardinal; + High: Cardinal; + + class operator Inc(const Operand: TLargeCardinal): TLargeCardinal; + class operator Dec(const Operand: TLargeCardinal): TLargeCardinal; + end; + +{ TLargeCardinal } + +class operator TLargeCardinal.Dec(const Operand: TLargeCardinal): TLargeCardinal; +begin + Result := Operand; + Dec(Result.Low); + + if Result.Low = $FFFFFFFF then + Dec(Result.High); +end; + +class operator TLargeCardinal.Inc(const Operand: TLargeCardinal): TLargeCardinal; +begin + Result := Operand; + Inc(Result.Low); + + if Result.Low = 0 then + Inc(Result.High); +end; + +var + Value: TLargeCardinal; + +begin + Value.Low := $FFFFFFFF; + Value.High := 0; + + Inc(Value); + + if (Value.Low <> 0) or (Value.High <> 1) then + Halt(1); + + Dec(Value); + + if (Value.Low <> $FFFFFFFF) or (Value.High <> 0) then + Halt(1); +end.