Following up from my previous question.
Can anyone explain why the following code compiles without any errors:
typedef array<VdbMethodInfo^> MethodArray;
typedef array<VdbParameterInfo^> ParameterArray;
ParameterArray^ parameters = gcnew ParameterArray {
gcnew VdbParameterInfo("name", "string", "Paul")};
MethodArray^ methods = gcnew MethodArray {
gcnew VdbMethodInfo("createTable", parameters)
};
Yet this gives me "error C2440: 'initializing' : cannot convert from 'VdbParameterInfo ^' to 'VdbMethodInfo ^"
typedef array<VdbMethodInfo^> MethodArray;
typedef array<VdbParameterInfo^> ParameterArray;
MethodArray^ methods = gcnew MethodArray {
gcnew VdbMethodInfo("createTable", gcnew ParameterArray {
gcnew VdbParameterInfo("name", "string", "Paul")};
)
};
All I've done is attempt to "nest" the parameter array inside the method array initialization... Not directly mind - VdbMethodInfo's constructor takes, as a second argument, a ParameterArray.
It seems to imply that managed C++ array initialization expects any recursive nesting to have the same type... (i.e. I think this must be a bug)
Related question : here