Browse Source

* re-enabled enum -> dispinterface typecasts after r21069, bug noticed by
Paul

git-svn-id: trunk@21076 -

Jonas Maebe 13 years ago
parent
commit
564445da8c
2 changed files with 11 additions and 1 deletions
  1. 1 1
      compiler/defcmp.pas
  2. 10 0
      compiler/symdef.pas

+ 1 - 1
compiler/defcmp.pas

@@ -764,7 +764,7 @@ implementation
                    begin
                      { ugly, but delphi allows it }
                      if (cdo_explicit in cdoptions) and
-                        is_class_or_interface_or_objc_or_java(def_from) then
+                        is_class_or_interface_or_dispinterface_or_objc_or_java(def_from) then
                        begin
                          { in Java enums /are/ class instances, and hence such
                            typecasts must not be treated as integer-like

+ 10 - 0
compiler/symdef.pas

@@ -950,6 +950,7 @@ interface
     function is_class_or_interface(def: tdef): boolean;
     function is_class_or_interface_or_objc(def: tdef): boolean;
     function is_class_or_interface_or_objc_or_java(def: tdef): boolean;
+    function is_class_or_interface_or_dispinterface_or_objc_or_java(def: tdef): boolean;
     function is_class_or_interface_or_object(def: tdef): boolean;
     function is_class_or_interface_or_dispinterface(def: tdef): boolean;
     function is_implicit_pointer_object_type(def: tdef): boolean;
@@ -6605,6 +6606,15 @@ implementation
       end;
 
 
+    function is_class_or_interface_or_dispinterface_or_objc_or_java(def: tdef): boolean;
+      begin
+        result:=
+          assigned(def) and
+          (def.typ=objectdef) and
+          (tobjectdef(def).objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_dispinterface,odt_objcclass,odt_objcprotocol,odt_javaclass,odt_interfacejava]);
+      end;
+
+
     function is_class_or_interface_or_object(def: tdef): boolean;
       begin
         result:=