Created
November 27, 2013 08:35
-
-
Save marek-safar/7672515 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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