diff --git a/.gitattributes b/.gitattributes index 73179c0adb..4412f4a65c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16308,6 +16308,7 @@ tests/webtbs/tw32150.pp svneol=native#text/pascal tests/webtbs/tw3216.pp svneol=native#text/plain tests/webtbs/tw32160.pp svneol=native#text/plain tests/webtbs/tw3217.pp svneol=native#text/plain +tests/webtbs/tw32179.pp svneol=native#text/plain tests/webtbs/tw3222.pp svneol=native#text/plain tests/webtbs/tw3226.pp svneol=native#text/plain tests/webtbs/tw3227.pp svneol=native#text/plain diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index 8a54f1f6de..d5d255a4a7 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -1880,7 +1880,7 @@ implementation else { Just about everything can be converted to a formaldef...} if not (def_from.typ in [abstractdef,errordef]) then - eq:=te_convert_l2; + eq:=te_convert_l6; end; end; diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index 0280a1430d..2ed7012a77 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -1964,7 +1964,7 @@ implementation { all types can be passed to a formaldef, but it is not the prefered way } if not is_constnode(fromnode) then - eq:=te_convert_l2 + eq:=te_convert_l6 else eq:=te_incompatible; end; @@ -2037,11 +2037,6 @@ implementation begin { Note: eq must be already valid, it will only be updated! } case def_to.typ of - formaldef : - begin - { all types can be passed to a formaldef } - eq:=te_equal; - end; stringdef : begin { to support ansi/long/wide strings in a proper way } diff --git a/tests/webtbs/tw32179.pp b/tests/webtbs/tw32179.pp new file mode 100644 index 0000000000..0bbf170053 --- /dev/null +++ b/tests/webtbs/tw32179.pp @@ -0,0 +1,26 @@ +{$mode delphi} + +type + TGuidHelper = record helper for TGUID + Class Function Create(const Data): TGUID; overload; static; inline; + Class Function Create(const S: string): TGUID; overload; static; + end; + +class function TGuidHelper.Create(const Data): TGUID; +begin + halt(1); +end; + +class function TGuidHelper.Create(const S: string): TGUID; +begin + writeln('B'); +end; + +var + c: PChar; + g: TGUID; +begin + g.Create(utf8string(c)); // will print 'A' + g.Create(unicodestring(c)); // will print 'A' + g.Create(shortstring(c)); // will print 'A' +end.