mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 00:09:32 +02:00
* don't look for overloaded operators in case of internally generated
type conversions (mantis #28375) git-svn-id: trunk@31191 -
This commit is contained in:
parent
ee87d3bba9
commit
fa1ac2515e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14529,6 +14529,7 @@ tests/webtbs/tw2832.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2834.pp svneol=native#text/plain
|
||||
tests/webtbs/tw28372.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2841.pp svneol=native#text/plain
|
||||
tests/webtbs/tw28475.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2853.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2853a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2853b.pp svneol=native#text/plain
|
||||
|
@ -2168,7 +2168,8 @@ implementation
|
||||
cdoptions:=[cdo_allow_variant,cdo_warn_incompatible_univ];
|
||||
{ overloaded operators require calls, which is not possible inside
|
||||
a constant declaration }
|
||||
if block_type<>bt_const then
|
||||
if (block_type<>bt_const) and
|
||||
not(nf_internal in flags) then
|
||||
include(cdoptions,cdo_check_operator);
|
||||
if nf_explicit in flags then
|
||||
include(cdoptions,cdo_explicit);
|
||||
|
24
tests/webtbs/tw28475.pp
Normal file
24
tests/webtbs/tw28475.pp
Normal file
@ -0,0 +1,24 @@
|
||||
{ %opt=-g-t }
|
||||
|
||||
program trashtest;
|
||||
|
||||
{$MODE OBJFPC}
|
||||
|
||||
type
|
||||
TTestRec = record
|
||||
Field1 : Int64;
|
||||
end;
|
||||
|
||||
operator := (i: TTestRec) fR: Int64;
|
||||
begin
|
||||
fR := i.Field1;
|
||||
end;
|
||||
|
||||
function TestFunc:TTestRec;
|
||||
begin //error reported here
|
||||
TestFunc.Field1 := 1;
|
||||
end;
|
||||
|
||||
begin
|
||||
WriteLn(TestFunc.Field1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user