* don't allow ordinal->ptr-based-objectdef conversions on managed platforms,

even in Delphi mode (mantis #22401)

git-svn-id: trunk@21840 -
This commit is contained in:
Jonas Maebe 2012-07-10 09:24:13 +00:00
parent c2be657671
commit 63ab1bae3e

View File

@ -1533,13 +1533,18 @@ implementation
doconv:=tc_variant_2_interface;
eq:=te_convert_l2;
end
{ ugly, but delphi allows it }
{ ugly, but delphi allows it (enables typecasting ordinals/
enums of any size to pointer-based object defs) }
{ in Java enums /are/ class instances, and hence such
typecasts must not be treated as integer-like conversions
typecasts must not be treated as integer-like conversions;
arbitrary constants cannot be converted into classes/
pointer-based values either on the JVM -> always return
false and let it be handled by the regular explicit type
casting code
}
else if ((not(target_info.system in systems_jvm) and
(def_from.typ=enumdef)) or
(def_from.typ=orddef)) and
else if (not(target_info.system in systems_jvm) and
((def_from.typ=enumdef) or
(def_from.typ=orddef))) and
(m_delphi in current_settings.modeswitches) and
(cdo_explicit in cdoptions) then
begin