mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 23:10:25 +02:00
* allow enum => pointer type casts in delphi mode, resolves #8465
git-svn-id: trunk@7905 -
This commit is contained in:
parent
4ba2a49318
commit
76a3d55199
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7381,6 +7381,7 @@ tests/webtbf/tw8150g.pp svneol=native#text/plain
|
|||||||
tests/webtbf/tw8264a.pp svneol=native#text/plain
|
tests/webtbf/tw8264a.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw8398.pp svneol=native#text/plain
|
tests/webtbf/tw8398.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw8451.pp svneol=native#text/plain
|
tests/webtbf/tw8451.pp svneol=native#text/plain
|
||||||
|
tests/webtbf/tw8465a.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw8528.pp svneol=native#text/plain
|
tests/webtbf/tw8528.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw8583.pp svneol=native#text/plain
|
tests/webtbf/tw8583.pp svneol=native#text/plain
|
||||||
tests/webtbf/tw8588.pp svneol=native#text/plain
|
tests/webtbf/tw8588.pp svneol=native#text/plain
|
||||||
|
@ -933,7 +933,6 @@ implementation
|
|||||||
eq:=te_convert_l1;
|
eq:=te_convert_l1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{
|
|
||||||
enumdef :
|
enumdef :
|
||||||
begin
|
begin
|
||||||
{ allow explicit typecasts from enums to pointer.
|
{ allow explicit typecasts from enums to pointer.
|
||||||
@ -950,7 +949,6 @@ implementation
|
|||||||
eq:=te_convert_l1;
|
eq:=te_convert_l1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
}
|
|
||||||
arraydef :
|
arraydef :
|
||||||
begin
|
begin
|
||||||
{ string constant (which can be part of array constructor)
|
{ string constant (which can be part of array constructor)
|
||||||
|
18
tests/webtbf/tw8465a.pp
Normal file
18
tests/webtbf/tw8465a.pp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{ %fail }
|
||||||
|
program EnumPtrConvTest;
|
||||||
|
|
||||||
|
{$APPTYPE CONSOLE}
|
||||||
|
|
||||||
|
{$packenum 1}
|
||||||
|
type
|
||||||
|
TEnum = (a, b);
|
||||||
|
|
||||||
|
var
|
||||||
|
e: TEnum;
|
||||||
|
p: Pointer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
e := b;
|
||||||
|
p := Pointer(e);
|
||||||
|
WriteLn(Integer(p)); // produces "1" in Delphi
|
||||||
|
end.
|
@ -5,6 +5,7 @@ program EnumPtrConvTest;
|
|||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
{$MODE DELPHI}
|
{$MODE DELPHI}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$packenum 1}
|
||||||
|
|
||||||
type
|
type
|
||||||
TEnum = (a, b);
|
TEnum = (a, b);
|
||||||
@ -16,5 +17,6 @@ var
|
|||||||
begin
|
begin
|
||||||
e := b;
|
e := b;
|
||||||
p := Pointer(e);
|
p := Pointer(e);
|
||||||
WriteLn(Integer(p)); // produces "1" in Delphi
|
if Integer(p)<>1 then
|
||||||
|
halt(1); // produces "1" in Delphi
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user