-- Zusammenführen von r46973 in ».«:

U    compiler/htypechk.pas
U    compiler/ncal.pas
A    tests/webtbs/tw37796.pp
-- Aufzeichnung der Informationen für Zusammenführung von r46973 in ».«:
 U   .

git-svn-id: branches/fixes_3_2@47908 -
This commit is contained in:
florian 2020-12-30 14:22:51 +00:00
parent 83f7e7e3dc
commit 7eeaf5d5a0
4 changed files with 48 additions and 0 deletions

1
.gitattributes vendored
View File

@ -17805,6 +17805,7 @@ tests/webtbs/tw3768.pp svneol=native#text/plain
tests/webtbs/tw3774.pp svneol=native#text/plain
tests/webtbs/tw3777.pp svneol=native#text/plain
tests/webtbs/tw3778.pp svneol=native#text/plain
tests/webtbs/tw37796.pp svneol=native#text/pascal
tests/webtbs/tw3780.pp svneol=native#text/plain
tests/webtbs/tw37806.pp svneol=native#text/pascal
tests/webtbs/tw3782.pp svneol=native#text/plain

View File

@ -1781,6 +1781,7 @@ implementation
mayberesettypeconvs;
exit;
end;
arrayconstructorn,
setconstn,
stringconstn,
guidconstn :
@ -2082,6 +2083,7 @@ implementation
(tstringdef(def_to).encoding=tstringdef(p.resultdef).encoding) then
eq:=te_equal
end;
formaldef,
setdef :
begin
{ set can also be a not yet converted array constructor }

View File

@ -1205,6 +1205,13 @@ implementation
(parasym.vardef.typ=setdef) then
inserttypeconv(left,parasym.vardef);
{ if an array constructor can be a set and it is passed to
a formaldef, a set must be passed, see also issue #37796 }
if (left.nodetype=arrayconstructorn) and
(parasym.vardef.typ=formaldef) and
(arrayconstructor_can_be_set(left)) then
left:=arrayconstructor_to_set(left,false);
{ set some settings needed for arrayconstructor }
if is_array_constructor(left.resultdef) then
begin

38
tests/webtbs/tw37796.pp Normal file
View File

@ -0,0 +1,38 @@
program tformal;
{$mode objfpc}
uses
sysutils;
type
TFontStyle = (
fsItalic,
fsBold,
fsUnderlined,
fsStrikeOut
);
TFontStyles = set of TFontStyle;
var aFS: TFontStyles;
procedure Any(const Anything);
begin
aFS:=aFS+TFontStyles(Anything);
Writeln(IntToHex(PLongInt(@Anything)^, 8));
end;
procedure DoIt;
begin
Any([fsItalic, fsBold]); //unit1.pas(31,25) Error: Variable identifier expected
if aFS<>[fsItalic, fsBold] then
halt(1);
Any(Cardinal([fsItalic, fsBold])); //ok
end;
begin
aFS:=[];
writeln(Cardinal(aFS));
DoIt;
writeln(Cardinal(aFS));
writeln('ok');
end.