mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-10 10:28:54 +02:00
* make "formal const/var" parameters the least preferred conversion
(mantis #32179) - removed code to handle conversion to formaldef parameters that are not by reference (so the default conversion preference is kept) git-svn-id: trunk@40012 -
This commit is contained in:
parent
33463c8698
commit
9bd931e931
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 }
|
||||
|
26
tests/webtbs/tw32179.pp
Normal file
26
tests/webtbs/tw32179.pp
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user