diff --git a/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs b/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs index 1dc770bb..628a2ba5 100644 --- a/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs +++ b/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs @@ -158,6 +158,16 @@ namespace CppSharp.Passes throw new Exception(string.Format( "Property {0} has a base property null but its getter has a generated base method.", getter.QualifiedOriginalName)); + if (baseVirtualProperty != null && !baseVirtualProperty.IsVirtual) + { + // the only way the above can happen is if we are generating properties in abstract implementations + // in which case we can have less naming conflicts since the abstract base can also contain non-virtual properties + if (getter.SynthKind == FunctionSynthKind.AbstractImplCall) + return; + throw new Exception(string.Format( + "Base of property {0} is not virtual while the getter is.", + getter.QualifiedOriginalName)); + } if (baseVirtualProperty != null && baseVirtualProperty.SetMethod == null) setter = null; } diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index ad9ea1ba..01b464de 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -931,3 +931,11 @@ template struct iterator_category_with_traversal : Category, Traversal { }; + + +class HasConflictWithAbstractProperty +{ +public: + int conflictWithProperty(); + virtual int getConflictWithProperty() = 0; +};