mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 12:10:45 +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
|
||||
if hdef.typ=procdef then
|
||||
begin
|
||||
if block_type<>bt_body then
|
||||
if not(block_type in inline_specialization_block_types) then
|
||||
message(parser_e_illegal_expression);
|
||||
srsym:=tprocdef(hdef).procsym;
|
||||
if assigned(spezcontext.symtable) then
|
||||
@ -3721,7 +3721,7 @@ implementation
|
||||
dopostfix:=false
|
||||
else
|
||||
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
|
||||
begin
|
||||
idstr:='';
|
||||
|
@ -31,7 +31,7 @@ uses
|
||||
symtype,symbase;
|
||||
|
||||
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
|
||||
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