mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-22 16:38:19 +02:00
* allow type = type ... ; syntax only for previously declared types, avoids also internal error for #40566
This commit is contained in:
parent
b61a0fab97
commit
bccc0b195e
@ -781,7 +781,6 @@ implementation
|
||||
genorgtypename:=orgtypename;
|
||||
end;
|
||||
|
||||
|
||||
consume(_EQ);
|
||||
|
||||
{ support 'ttype=type word' syntax }
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -1,4 +1,5 @@
|
||||
{ %NORUN}
|
||||
{ %fail }
|
||||
program tw25077;
|
||||
|
||||
TYPE AnyName = TYPE PROCEDURE (A : INTEGER);
|
13
tests/webtbf/tw40566a.pp
Normal file
13
tests/webtbf/tw40566a.pp
Normal file
@ -0,0 +1,13 @@
|
||||
{ %fail }
|
||||
{$mode objfpc}
|
||||
|
||||
program Project1;
|
||||
type
|
||||
Tbar = type class
|
||||
f:integer;
|
||||
end;
|
||||
|
||||
// tabc = specialize TBar<integer>; // Internal error 2012101001
|
||||
|
||||
begin
|
||||
end.
|
15
tests/webtbf/tw40566b.pp
Normal file
15
tests/webtbf/tw40566b.pp
Normal file
@ -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<integer>; // Internal error 2012101001
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user