mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 21:29:42 +02:00
+ Reject object types without VMT as arguments of typeof(). Without this check, an undefined reference to VMT is generated which fails at the linking stage.
git-svn-id: trunk@21923 -
This commit is contained in:
parent
a4be3f17d7
commit
684bf4fba2
@ -1866,6 +1866,8 @@ type_e_interface_lower_visibility=04117_E_The interface method "$1" has a higher
|
|||||||
% warning that is disabled by default because such situations are common
|
% warning that is disabled by default because such situations are common
|
||||||
% practice, but it can be enabled in case you are concerned with keeping your
|
% practice, but it can be enabled in case you are concerned with keeping your
|
||||||
% code compilable for the JVM target.
|
% code compilable for the JVM target.
|
||||||
|
type_e_typeof_requires_vmt=04118_E_TYPEOF can only be used on object types with VMT
|
||||||
|
% Typeof() intrinsic returns pointer to VMT of its argument. It cannot be used on object types that do not have VMT.
|
||||||
% \end{description}
|
% \end{description}
|
||||||
#
|
#
|
||||||
# Symtable
|
# Symtable
|
||||||
|
@ -525,6 +525,7 @@ const
|
|||||||
type_e_no_managed_assign_generic_typecast=04115;
|
type_e_no_managed_assign_generic_typecast=04115;
|
||||||
type_w_interface_lower_visibility=04116;
|
type_w_interface_lower_visibility=04116;
|
||||||
type_e_interface_lower_visibility=04117;
|
type_e_interface_lower_visibility=04117;
|
||||||
|
type_e_typeof_requires_vmt=04118;
|
||||||
sym_e_id_not_found=05000;
|
sym_e_id_not_found=05000;
|
||||||
sym_f_internal_error_in_symtablestack=05001;
|
sym_f_internal_error_in_symtablestack=05001;
|
||||||
sym_e_duplicate_id=05002;
|
sym_e_duplicate_id=05002;
|
||||||
@ -944,9 +945,9 @@ const
|
|||||||
option_info=11024;
|
option_info=11024;
|
||||||
option_help_pages=11025;
|
option_help_pages=11025;
|
||||||
|
|
||||||
MsgTxtSize = 66002;
|
MsgTxtSize = 66059;
|
||||||
|
|
||||||
MsgIdxMax : array[1..20] of longint=(
|
MsgIdxMax : array[1..20] of longint=(
|
||||||
26,92,323,118,87,56,116,26,202,63,
|
26,92,323,119,87,56,116,26,202,63,
|
||||||
53,20,1,1,1,1,1,1,1,1
|
53,20,1,1,1,1,1,1,1,1
|
||||||
);
|
);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2520,7 +2520,11 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if target_info.system in systems_managed_vm then
|
if target_info.system in systems_managed_vm then
|
||||||
message(parser_e_feature_unsupported_for_vm);
|
message(parser_e_feature_unsupported_for_vm);
|
||||||
|
typecheckpass(left);
|
||||||
set_varstate(left,vs_read,[]);
|
set_varstate(left,vs_read,[]);
|
||||||
|
if (left.resultdef.typ=objectdef) and
|
||||||
|
not(oo_has_vmt in tobjectdef(left.resultdef).objectoptions) then
|
||||||
|
message(type_e_typeof_requires_vmt);
|
||||||
resultdef:=voidpointertype;
|
resultdef:=voidpointertype;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user