Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/mcs/mcs/method.cs b/mcs/mcs/method.cs
index ca6ef5d..4416c00 100644
--- a/mcs/mcs/method.cs
+++ b/mcs/mcs/method.cs
@@ -1466,7 +1466,7 @@ namespace Mono.CSharp {
} else {
//
// It is legal to have "this" initializers that take no arguments
- // in structs, they are just no-ops.
+ // in structs
//
// struct D { public D (int a) : this () {}
//
@@ -1487,9 +1487,14 @@ namespace Mono.CSharp {
public override void Emit (EmitContext ec)
{
- // It can be null for static initializers
- if (base_ctor == null)
+ //
+ // It can be null for struct initializers
+ //
+ if (base_ctor == null) {
+ ec.Emit (OpCodes.Ldarg_0);
+ ec.Emit (OpCodes.Initobj, type);
return;
+ }
var call = new CallEmitter ();
call.InstanceExpression = new CompilerGeneratedThis (type, loc);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment