Browse Source

Fixed the generated C# when a protected constructor has a parameter with a protected type.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/902/head
Dimitar Dobrev 8 years ago
parent
commit
2002377f27
  1. 6
      src/Generator/Passes/ConstructorToConversionOperatorPass.cs
  2. 10
      tests/Common/Common.h

6
src/Generator/Passes/ConstructorToConversionOperatorPass.cs

@ -12,8 +12,10 @@ namespace CppSharp.Passes @@ -12,8 +12,10 @@ namespace CppSharp.Passes
{
public override bool VisitMethodDecl(Method method)
{
if (AlreadyVisited(method) || !method.IsGenerated || !method.IsConstructor ||
method.IsCopyConstructor)
if (AlreadyVisited(method) || !method.IsGenerated || !method.IsConstructor
|| method.IsCopyConstructor
// conversion operators can only be public
|| method.Access != AccessSpecifier.Public)
return false;
var @params = method.Parameters.Where(p => p.Kind == ParameterKind.Regular).ToList();

10
tests/Common/Common.h

@ -1312,3 +1312,13 @@ public: @@ -1312,3 +1312,13 @@ public:
~HasVirtualFunctionWithBoolParams();
virtual bool virtualFunctionWithBoolParamAndReturnsBool(bool testBool);
};
class HasProtectedCtorWithProtectedParam
{
protected:
enum ProtectedEnum
{
Member
};
HasProtectedCtorWithProtectedParam(ProtectedEnum protectedParam);
};

Loading…
Cancel
Save