diff --git a/.gitattributes b/.gitattributes index c70bb5ef1a..cea24a31c0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index f861327f2c..6913edb5ba 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -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); diff --git a/tests/test/ttypeconvtypes.pp b/tests/test/ttypeconvtypes.pp new file mode 100644 index 0000000000..6d6d984cd8 --- /dev/null +++ b/tests/test/ttypeconvtypes.pp @@ -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. \ No newline at end of file