mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 09:30:21 +02:00
* handle except blocks as normal code block with regard to specialization of generics, resolves #40890
This commit is contained in:
parent
4ed3e6d002
commit
76fc3275bc
@ -3446,7 +3446,7 @@ implementation
|
|||||||
else
|
else
|
||||||
if hdef.typ=procdef then
|
if hdef.typ=procdef then
|
||||||
begin
|
begin
|
||||||
if block_type<>bt_body then
|
if not(block_type in inline_specialization_block_types) then
|
||||||
message(parser_e_illegal_expression);
|
message(parser_e_illegal_expression);
|
||||||
srsym:=tprocdef(hdef).procsym;
|
srsym:=tprocdef(hdef).procsym;
|
||||||
if assigned(spezcontext.symtable) then
|
if assigned(spezcontext.symtable) then
|
||||||
@ -3721,7 +3721,7 @@ implementation
|
|||||||
dopostfix:=false
|
dopostfix:=false
|
||||||
else
|
else
|
||||||
if (m_delphi in current_settings.modeswitches) and
|
if (m_delphi in current_settings.modeswitches) and
|
||||||
(block_type=bt_body) and
|
(block_type in inline_specialization_block_types) and
|
||||||
(token in [_LT,_LSHARPBRACKET]) then
|
(token in [_LT,_LSHARPBRACKET]) then
|
||||||
begin
|
begin
|
||||||
idstr:='';
|
idstr:='';
|
||||||
|
@ -31,7 +31,7 @@ uses
|
|||||||
symtype,symbase;
|
symtype,symbase;
|
||||||
|
|
||||||
const
|
const
|
||||||
inline_specialization_block_types = [bt_type,bt_var_type,bt_const_type,bt_body];
|
inline_specialization_block_types = [bt_type,bt_var_type,bt_const_type,bt_body,bt_except];
|
||||||
|
|
||||||
type
|
type
|
||||||
tspecializationstate = record
|
tspecializationstate = record
|
||||||
|
13
tests/webtbs/tw40890.pp
Normal file
13
tests/webtbs/tw40890.pp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{$mode objfpc}
|
||||||
|
generic procedure Foo<T>;
|
||||||
|
begin
|
||||||
|
WriteLn('Bar');
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
specialize Foo<Integer>; // this one works
|
||||||
|
except
|
||||||
|
specialize Foo<Integer>; // Error: Identifier not found "specialize"
|
||||||
|
end;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user