Skip to content

Commit

Permalink
Fix implicit non-trivial default ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
Saalvage committed Oct 20, 2023
1 parent 43626c3 commit f542095
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Generator/AST/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static bool CheckIgnoreMethod(Method method)
var isEmptyCtor = method.IsConstructor && method.Parameters.Count == 0;

var @class = method.Namespace as Class;
if (@class != null && @class.IsValueType && isEmptyCtor && method.IsDefaulted)
if (@class != null && @class.IsValueType && isEmptyCtor && !@class.HasNonTrivialDefaultConstructor)
return true;

if (method.IsDestructor)
Expand Down
1 change: 0 additions & 1 deletion tests/dotnet/CSharp/CSharp.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,6 @@ public void TestValueTypeStringMemberDefaulted()
}

[Test]
[Ignore("https://github.com/mono/CppSharp/issues/1777")]
public void TestValueTypeStringMemberDefaultedCtor()
{
var test = new CSharp.ValueTypeNoCtor();
Expand Down
2 changes: 1 addition & 1 deletion tests/dotnet/Common/Common.CSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>10.0</LangVersion>
<LangVersion>11.0</LangVersion>
</PropertyGroup>
</Project>

0 comments on commit f542095

Please sign in to comment.