mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 13:29:27 +02:00
Fix for Mantis #24872.
psub.pas, tcgprocinfo.parse_body: * also check record symtables besides object symtables to determine whether the staticsymtable is accessed from a globally declared generic * use a translateable message if the static symtable is accessed if it should not msg/errore.msg: + add new error message for when the static symtable is accessed from a global generic msgidx.inc & msgtixt.inc: * regenerated + added test git-svn-id: trunk@29427 -
This commit is contained in:
parent
b13e00ea70
commit
af43e5e3e9
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14060,6 +14060,7 @@ tests/webtbs/tw24863.pp svneol=native#text/plain
|
||||
tests/webtbs/tw24865.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw24867.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw24871.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw24872.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw24915.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2492.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2494.pp svneol=native#text/plain
|
||||
|
@ -411,7 +411,7 @@ scan_e_illegal_hugepointernormalization=02098_E_Illegal argument for HUGEPOINTER
|
||||
#
|
||||
# Parser
|
||||
#
|
||||
# 03338 is the last used one
|
||||
# 03339 is the last used one
|
||||
#
|
||||
% \section{Parser messages}
|
||||
% This section lists all parser messages. The parser takes care of the
|
||||
@ -1528,6 +1528,9 @@ parser_w_ptr_type_ignored=03338_W_Pointer type "$1" ignored
|
||||
% The specified pointer type modifier is ignored, because it is not supported on
|
||||
% the current platform. This happens, for example, when a far pointer is
|
||||
% declared on a non-x86 platform.
|
||||
parser_e_global_generic_references_static=03339_E_Global Generic template references static symtable
|
||||
% A generic declared in the interface section of a unit must not reference symbols that belong
|
||||
% solely to the implementation section of that unit.
|
||||
%
|
||||
%
|
||||
%
|
||||
|
@ -440,6 +440,7 @@ const
|
||||
parser_e_overloaded_have_same_mangled_name=03336;
|
||||
parser_e_default_value_val_const=03337;
|
||||
parser_w_ptr_type_ignored=03338;
|
||||
parser_e_global_generic_references_static=03339;
|
||||
type_e_mismatch=04000;
|
||||
type_e_incompatible_types=04001;
|
||||
type_e_not_equal_types=04002;
|
||||
@ -1000,9 +1001,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 74490;
|
||||
MsgTxtSize = 74549;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
26,99,339,123,95,57,126,27,202,64,
|
||||
26,99,340,123,95,57,126,27,202,64,
|
||||
58,20,1,1,1,1,1,1,1,1
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1795,11 +1795,11 @@ implementation
|
||||
{ Give an error for accesses in the static symtable that aren't visible
|
||||
outside the current unit }
|
||||
st:=procdef.owner;
|
||||
while (st.symtabletype=ObjectSymtable) do
|
||||
while (st.symtabletype in [ObjectSymtable,recordsymtable]) do
|
||||
st:=st.defowner.owner;
|
||||
if (pi_uses_static_symtable in flags) and
|
||||
(st.symtabletype<>staticsymtable) then
|
||||
Comment(V_Error,'Global Generic template references static symtable');
|
||||
Message(parser_e_global_generic_references_static);
|
||||
end;
|
||||
|
||||
{ save exit info }
|
||||
|
23
tests/webtbs/tw24872.pp
Normal file
23
tests/webtbs/tw24872.pp
Normal file
@ -0,0 +1,23 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tw24872;
|
||||
|
||||
{$mode delphi}
|
||||
|
||||
procedure Test;
|
||||
begin
|
||||
end;
|
||||
|
||||
type
|
||||
TRec<T> = record {for generic class is ok, and non generic record too}
|
||||
procedure Foo;
|
||||
end;
|
||||
|
||||
procedure TRec<T>.Foo;
|
||||
begin
|
||||
Test
|
||||
end; // Error: Global Generic template references static symtable
|
||||
|
||||
begin
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user