From a170d1b09abb81bdfeab7b7602fa678fb06ed6fb Mon Sep 17 00:00:00 2001 From: marcos henrich Date: Sun, 6 Apr 2014 15:49:42 +0100 Subject: [PATCH] Ignore copy constructor if a base class don't has or has a private copy constructor --- src/Generator/AST/Utils.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Generator/AST/Utils.cs b/src/Generator/AST/Utils.cs index 8490afb8..221ec035 100644 --- a/src/Generator/AST/Utils.cs +++ b/src/Generator/AST/Utils.cs @@ -1,5 +1,6 @@  using System; +using System.Linq; namespace CppSharp.AST { @@ -37,6 +38,21 @@ namespace CppSharp.AST if (method.Access == AccessSpecifier.Private && !method.IsOverride) return true; + //Ignore copy constructor if a base class don't has or has a private copy constructor + if (method.IsCopyConstructor) + { + var baseClass = @class; + while (baseClass != null && baseClass.HasBaseClass) + { + baseClass = baseClass.BaseClass; + var copyConstructor = baseClass.Methods.FirstOrDefault(m => m.IsCopyConstructor); + if (copyConstructor == null + || copyConstructor.Access == AccessSpecifier.Private + || copyConstructor.Ignore) + return true; + } + } + return false; }