title: Decltype cast operator in Visual Studio
body: <p>Consider following code example:</p>
  
  <pre><code>#include &lt;algorithm&gt;
  
  template&lt;class T, class U&gt;
  struct lazy_caller{
      lazy_caller(T &amp;&amp;one, U &amp;&amp;two) : m_one(one), m_two(two){} 
  
      operator decltype(std::max(T(), U()))() const {
          return std::max(m_one, m_two);
      }
  
      T m_one;
      U m_two;
  };
  
  int main()
  {
      lazy_caller&lt;int, int&gt; caller(1, 2);
      int i = caller;
      return 0;
  }
  </code></pre>
  
  <p>As you may imagine, in real code I wanted to do more sophisticated type deduction to create appropriate conversion operator. Anyway - this code does not compile in VS2017 (and I guess the same is with earlier ones) - and so I would like to ask if there is any workaround for this issue? I have already tried:</p>
  
  <pre><code>operator auto () const
  </code></pre>
  
  <p>It also generates compiler errors like:</p>
  
  <pre><code>source_file.cpp(8): error C2833: 'operator function-style cast' is not a recognized operator or type
  </code></pre>
  
  <p>Is there any solution for this problem with msvc? 
  Because gcc has not problem with neither <code>operator auto</code> nor <code>operator decltype(..)</code>.</p>