mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-31 23:22:34 +02:00
* correctly write an error if one tries to implement a method introduced in a generic in a specialization of the generic, resolves issue #23169
git-svn-id: trunk@31241 -
This commit is contained in:
parent
a67a35c498
commit
ee89e99189
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13136,6 +13136,7 @@ tests/webtbf/tw2281.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2285.pp svneol=native#text/plain
|
||||
tests/webtbf/tw22941.pp svneol=native#text/plain
|
||||
tests/webtbf/tw23110.pp svneol=native#text/plain
|
||||
tests/webtbf/tw23169.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw23546b.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw23547a.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw23547b.pp svneol=native#text/pascal
|
||||
|
@ -1534,7 +1534,8 @@ parser_e_global_generic_references_static=03339_E_Global Generic template refere
|
||||
parser_u_already_compiled=03340_UL_Unit $1 has been already compiled meanwhile.
|
||||
% This tells you that the recursive reading of the uses clauses triggered already
|
||||
% a compilation of the current unit, so the current compilation can be aborted.
|
||||
%
|
||||
parser_e_explicit_method_implementation_for_specializations_not_allowed=03341_E_Explicit implementation of methods for specializations of generics is not allowed
|
||||
% Methods introduced in a generic must be implemented for the generic. It is not possible to implement them only for specializations.
|
||||
%
|
||||
%
|
||||
% \end{description}
|
||||
|
@ -442,6 +442,7 @@ const
|
||||
parser_w_ptr_type_ignored=03338;
|
||||
parser_e_global_generic_references_static=03339;
|
||||
parser_u_already_compiled=03340;
|
||||
parser_e_explicit_method_implementation_for_specializations_not_allowed=03341;
|
||||
type_e_mismatch=04000;
|
||||
type_e_incompatible_types=04001;
|
||||
type_e_not_equal_types=04002;
|
||||
@ -1010,9 +1011,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 75410;
|
||||
MsgTxtSize = 75500;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
26,99,341,124,96,58,126,32,202,64,
|
||||
26,99,342,124,96,58,126,32,202,64,
|
||||
58,20,1,1,1,1,1,1,1,1
|
||||
);
|
||||
|
1036
compiler/msgtxt.inc
1036
compiler/msgtxt.inc
File diff suppressed because it is too large
Load Diff
@ -995,6 +995,8 @@ implementation
|
||||
parse_generic:=true;
|
||||
end;
|
||||
if (df_specialization in pd.struct.defoptions) then
|
||||
begin
|
||||
if assigned(current_specializedef) then
|
||||
begin
|
||||
include(pd.defoptions,df_specialization);
|
||||
{ Find corresponding genericdef, we need it later to
|
||||
@ -1035,6 +1037,9 @@ implementation
|
||||
if not assigned(pd.genericdef) or
|
||||
(pd.genericdef.typ<>procdef) then
|
||||
internalerror(200512115);
|
||||
end
|
||||
else
|
||||
Message(parser_e_explicit_method_implementation_for_specializations_not_allowed);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
18
tests/webtbf/tw23169.pp
Normal file
18
tests/webtbf/tw23169.pp
Normal file
@ -0,0 +1,18 @@
|
||||
{ %fail }
|
||||
{$mode objfpc}
|
||||
uses gvector;
|
||||
|
||||
type
|
||||
generic TObjectVector<T> = class(specialize TVector<T>)
|
||||
procedure X; //Destroy; override;
|
||||
end;
|
||||
|
||||
TMyVector = specialize TObjectVector<TObject>;
|
||||
|
||||
//destructor TMyVector.Destroy;
|
||||
procedure TMyVector.X;
|
||||
begin
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user