Browse Source

Ignored the generated code for variable-sized array of a class/struct (#855)

Fixes #777
pull/856/merge
Mohit Mohta 8 years ago committed by Dimitar Dobrev
parent
commit
ebcbc10a04
  1. 12
      src/Generator/Types/TypeIgnoreChecker.cs
  2. 4
      tests/CSharp/CSharp.h

12
src/Generator/Types/TypeIgnoreChecker.cs

@ -138,14 +138,22 @@ namespace CppSharp @@ -138,14 +138,22 @@ namespace CppSharp
return false;
}
var arrayElemType = array.Type.Desugar();
if (array.SizeType == ArrayType.ArraySize.Incomplete &&
array.QualifiedType.Qualifiers.IsConst &&
!arrayElemType.IsPrimitiveType())
{
Ignore();
return false;
}
if (!array.QualifiedType.Visit(this))
return false;
if (array.SizeType != ArrayType.ArraySize.Constant)
return true;
var arrayElemType = array.Type.Desugar();
Class @class;
if (arrayElemType.TryGetClass(out @class) && @class.IsRefType)
return true;

4
tests/CSharp/CSharp.h

@ -1203,4 +1203,6 @@ public: @@ -1203,4 +1203,6 @@ public:
int TestIndexedProperties::operator[](const int& key)
{
return key;
}
}
extern const ComplexArrayElement ArrayOfVariableSize[];
Loading…
Cancel
Save