RAD Studio
ContentsIndex
PreviousUpNext
E2370: Simple type name expected

To ensure interoperability between Delphi and C++, there are restrictions on the type names mentioned in the parameter lists of published closure types. The parameter types have to be simple type names with optional const modifier and pointer or reference notation. 

So when declaring a closure type, the arguments passed to that closure must be of a simple type. For example, templates are not accepted. To pass a reference to an object of template type to a closure, you must declare a typedef, which counts as a simple type name. 

 

struct __declspec(delphiclass) foo
{
     typedef void __fastcall (__closure *foo1)(SomeTemplateType<int> *);
     typedef SomeTemplateType<int> SimpleTypeName;
     typedef void __fastcall (__closure *foo2)(SimpleTypeName *);
published:
     __property foo1 prop1;  // Error
     __property foo2 prop2;  // OK
};
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!