title: Cannot pass by reference in D language
body: <p>I have a constructor inside the class testclass</p>
  <pre class="lang-d prettyprint-override"><code>@safe public nothrow this(ref Socket socket) {
      // Inside class modulename.classname
      this.socket = socket;
  }
  </code></pre>
  <p>When I initialize an object of this type in my main method however, I got a few compile errors.</p>
  <pre class="lang-d prettyprint-override"><code>void main() {
      auto variablename = new modulename.classname(
          cast(Socket) new TcpSocket() // main.d line 5
      );
  }
  </code></pre>
  <p>Errors:</p>
  <pre><code>main.d(5): Error: constructor testmodule.testclass.this (ref 
  Socket socket) is not callable using argument types (Socket)
  main.d(5): Error: no constructor for testclass
  </code></pre>
  <p>Why cannot I pass the socket by reference?</p>