title: IL constrained call
body: <p>For this code:</p>
  
  <pre><code>class Program
  {
      static void Main()
      {
          Console.WriteLine(new MyStruct().ToString());
      }
  
      struct MyStruct { }
  }
  </code></pre>
  
  <p>the C# compiler generates <code>constrained callvirt</code> IL code.</p>
  
  <p><a href="https://msdn.microsoft.com/library/system.reflection.emit.opcodes.constrained.aspx" rel="nofollow">This</a> article says:</p>
  
  <blockquote>
    <p>For example, if a value type V overrides the Object.ToString() method, a call  V.ToString() instruction is emitted; if it does not, a box instruction and a callvirt  Object.ToString() instruction are emitted. A versioning problem can arise &lt;...> if an override is later added.</p>
  </blockquote>
  
  <p>So, my question is: why would it be a problem in this case if the compiler will generate a <code>box</code> code, not a constrained call?</p>