mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 02:49:32 +01:00
* makes compiler report nice error when one tries to use specialize for function result type, based on a patch by Aleksa Todorovic, part of #15875
git-svn-id: trunk@16438 -
This commit is contained in:
parent
cc0be1be4d
commit
675c3391d1
@ -1183,7 +1183,7 @@ parser_e_field_not_allowed_here=03251_E_Fields cannot appear after a method or p
|
||||
% without starting a new visibility section (such as \var{public}, \var{private}, etc.). The reason is
|
||||
% that otherwise the source code can appear ambiguous to the compiler, since it is possible to use modifiers
|
||||
% such as \var{default} and \var{register} also as field names.
|
||||
parser_e_no_local_para_def=03252_E_Parameters cannot contain local type definitions. Use a separate type definition in a type block.
|
||||
parser_e_no_local_para_def=03252_E_Parameters or result types cannot contain local type definitions. Use a separate type definition in a type block.
|
||||
% In Pascal, types are not considered to be identical simply because they are semantically equivalent.
|
||||
% Two variables or parameters are only considered to be of the same type if they refer to the
|
||||
% same type definition.
|
||||
|
||||
@ -871,7 +871,7 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 57889;
|
||||
MsgTxtSize = 57905;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
24,88,298,97,82,54,111,22,202,63,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -453,8 +453,20 @@ implementation
|
||||
begin
|
||||
if try_to_consume(_SPECIALIZE) then
|
||||
begin
|
||||
dospecialize:=true;
|
||||
again:=true;
|
||||
if not(allowtypedef) then
|
||||
begin
|
||||
Message(parser_e_no_local_para_def);
|
||||
|
||||
{ try to recover }
|
||||
while token<>_SEMICOLON do
|
||||
consume(token);
|
||||
def:=generrordef;
|
||||
end
|
||||
else
|
||||
begin
|
||||
dospecialize:=true;
|
||||
again:=true;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user