diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index bef9101dc6..356fea59bf 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -781,7 +781,6 @@ implementation genorgtypename:=orgtypename; end; - consume(_EQ); { support 'ttype=type word' syntax } diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 82d3c85334..0123b693b8 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -1725,10 +1725,16 @@ implementation name:=newsym.RealName else name:=''; + { type a = type ..,; syntax is allowed only with type syms and apparently helpers, see below } + if hadtypetoken and ((token<>_ID) or (idtoken=_REFERENCE)) and (token<>_STRING) and (token<>_FILE) then + consume(_ID); case token of _STRING,_FILE: begin - single_type(def,[stoAllowTypeDef]); + if hadtypetoken then + single_type(def,[]) + else + single_type(def,[stoAllowTypeDef]); end; _LKLAMMER: begin diff --git a/rtl/inc/systemh.inc b/rtl/inc/systemh.inc index 03c51cb3ab..6eca5d35d0 100644 --- a/rtl/inc/systemh.inc +++ b/rtl/inc/systemh.inc @@ -570,7 +570,7 @@ Type UTF8Char = AnsiChar; PUTF8Char = PAnsiChar; - UCS4Char = type 0..$10ffff; + UCS4Char = 0..$10ffff; PUCS4Char = ^UCS4Char; {$ifdef CPU16} TUCS4CharArray = array[0..32767 div sizeof(UCS4Char)-1] of UCS4Char; diff --git a/tests/webtbs/tw25077.pp b/tests/webtbf/tw25077.pp similarity index 85% rename from tests/webtbs/tw25077.pp rename to tests/webtbf/tw25077.pp index c18d6d8c3a..2a50534f77 100644 --- a/tests/webtbs/tw25077.pp +++ b/tests/webtbf/tw25077.pp @@ -1,4 +1,5 @@ { %NORUN} +{ %fail } program tw25077; TYPE AnyName = TYPE PROCEDURE (A : INTEGER); diff --git a/tests/webtbf/tw40566a.pp b/tests/webtbf/tw40566a.pp new file mode 100644 index 0000000000..211cea82f9 --- /dev/null +++ b/tests/webtbf/tw40566a.pp @@ -0,0 +1,13 @@ +{ %fail } +{$mode objfpc} + +program Project1; +type + Tbar = type class + f:integer; + end; + + // tabc = specialize TBar; // Internal error 2012101001 + +begin +end. diff --git a/tests/webtbf/tw40566b.pp b/tests/webtbf/tw40566b.pp new file mode 100644 index 0000000000..217fcaffe9 --- /dev/null +++ b/tests/webtbf/tw40566b.pp @@ -0,0 +1,15 @@ +{ %fail } +{$mode objfpc} +{$modeswitch FUNCTIONREFERENCES} +program Project1; +type +{ generic Tbar<_A> = type class + f:_A; + end;} + + a = type reference to procedure; + + tabc = specialize TBar; // Internal error 2012101001 + +begin +end.