mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-16 23:44:05 +01:00
compiler: allow type conversions for ordinal types inside type declarations e.g inside enumerations like: Byte(0)..Byte(15)
git-svn-id: trunk@19328 -
This commit is contained in:
parent
3bce487e30
commit
33a67704ac
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10552,6 +10552,7 @@ tests/test/tsubdecl.pp svneol=native#text/plain
|
|||||||
tests/test/tsymlibrary1.pp svneol=native#text/pascal
|
tests/test/tsymlibrary1.pp svneol=native#text/pascal
|
||||||
tests/test/ttpara1.pp svneol=native#text/plain
|
tests/test/ttpara1.pp svneol=native#text/plain
|
||||||
tests/test/ttpara2.pp svneol=native#text/plain
|
tests/test/ttpara2.pp svneol=native#text/plain
|
||||||
|
tests/test/ttypeconvtypes.pp svneol=native#text/pascal
|
||||||
tests/test/ttypedarray1.pp svneol=native#text/pascal
|
tests/test/ttypedarray1.pp svneol=native#text/pascal
|
||||||
tests/test/ttypedrecord1.pp svneol=native#text/plain
|
tests/test/ttypedrecord1.pp svneol=native#text/plain
|
||||||
tests/test/ttypedrecord2.pp svneol=native#text/plain
|
tests/test/ttypedrecord2.pp svneol=native#text/plain
|
||||||
|
|||||||
@ -1496,7 +1496,10 @@ implementation
|
|||||||
(token=_LT) and
|
(token=_LT) and
|
||||||
(m_delphi in current_settings.modeswitches) then
|
(m_delphi in current_settings.modeswitches) then
|
||||||
generate_specialization(hdef,false,'');
|
generate_specialization(hdef,false,'');
|
||||||
if not typeonly and try_to_consume(_LKLAMMER) then
|
{ allow Ordinal(Value) for type declarations since it
|
||||||
|
can be an enummeration declaration or a set lke:
|
||||||
|
(OrdinalType(const1)..OrdinalType(const2) }
|
||||||
|
if (not typeonly or is_ordinal(hdef))and try_to_consume(_LKLAMMER) then
|
||||||
begin
|
begin
|
||||||
p1:=comp_expr(true,false);
|
p1:=comp_expr(true,false);
|
||||||
consume(_RKLAMMER);
|
consume(_RKLAMMER);
|
||||||
|
|||||||
12
tests/test/ttypeconvtypes.pp
Normal file
12
tests/test/ttypeconvtypes.pp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{%norun}
|
||||||
|
program ttypeconvtypes;
|
||||||
|
|
||||||
|
// check that type conversions work in type declarations
|
||||||
|
// also check that codepage ansistring declaration also works
|
||||||
|
|
||||||
|
type
|
||||||
|
t866 = type AnsiString(866);
|
||||||
|
tbytes = byte(0)..byte(15);
|
||||||
|
tchars = ansichar(tbytes(0))..ansichar(tbytes(15));
|
||||||
|
begin
|
||||||
|
end.
|
||||||
Loading…
Reference in New Issue
Block a user