title: Calling a method on a temporary object
body: <p>I've had a little problem with calling a operator on a temporary object. I've stripped the code to the essential problem: </p>
  
  <pre><code>template&lt;typename T, typename OP&gt;
  struct X
  {
      X( const OP &amp;op ) : m_op( op ) { }
      X &amp;operator ()( T *pa, size_t n ) { /* ... */ return *this; }
      OP m_op;
  };
  
  int main()
  {
  //  Why does this work ...
      ((X&lt;int, less&lt;int&gt;&gt;)( less&lt;int&gt;() ))( nullptr, 123 );
  
  //  ... this doesn't work ...
  //  (X&lt;int, less&lt;int&gt;&gt;)( less&lt;int&gt;() )( nullptr, 123 );
  //  ... and this also doesn't work ...
  //  X&lt;int, less&lt;int&gt;&gt;( less&lt;int&gt;() )( nullptr, 123 );
  }
  </code></pre>
  
  <p>Maybe this is special to my compiler (VC++ 2015).</p>