* 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:
Jonas Maebe 2015-07-03 20:19:48 +00:00
parent ee87d3bba9
commit fa1ac2515e
3 changed files with 27 additions and 1 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
View 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.