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:
paul 2011-10-03 01:27:21 +00:00
parent 3bce487e30
commit 33a67704ac
3 changed files with 17 additions and 1 deletions

1
.gitattributes vendored
View File

@ -10552,6 +10552,7 @@ tests/test/tsubdecl.pp svneol=native#text/plain
tests/test/tsymlibrary1.pp svneol=native#text/pascal
tests/test/ttpara1.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/ttypedrecord1.pp svneol=native#text/plain
tests/test/ttypedrecord2.pp svneol=native#text/plain

View File

@ -1496,7 +1496,10 @@ implementation
(token=_LT) and
(m_delphi in current_settings.modeswitches) then
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
p1:=comp_expr(true,false);
consume(_RKLAMMER);

View 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.