title: Return type deduction substitution failure on clang, but not on g++
body: <p>The following snippet does not compile with <code>clang</code>, but with <code>g++</code> (details below):</p>
  
  <pre><code>#include &lt;utility&gt;
  
  struct S {
      template&lt;typename T&gt;
      void operator()(T&amp;&amp; /*t*/) {}
  
      template&lt;typename T0, typename T1, typename... Args&gt;
      auto operator()(T0&amp;&amp; t0, T1&amp;&amp; /*t1*/, Args&amp;&amp;... args) -&gt;
          decltype(operator()(std::forward&lt;T0&gt;(t0), std::forward&lt;Args&gt;(args)...))
      {}
  };
  
  int main(int /*argc*/, char** /*argv[]*/) {
      S()(1, 2);
      S()(1, 1.2, 1.2); // does not compile with clang
  }
  </code></pre>
  
  <p>I.e. the variadic <code>operator()</code> should recurse until it reaches the base case.</p>
  
  <p>When I compile this with <code>gcc 7.2.0</code> (<code>g++ -std=c++1y</code>), it compiles. But with <code>clang 3.8.0</code> (<code>clang++ -std=c++1y</code>), I obtain the following compilation failure:</p>
  
  <pre><code>main.cpp:15:5: error: no matching function for call to object of type 'S'
      S()(1, 1.2, 1.2); // does not compile with clang
      ^~~
  main.cpp:8:10: note: candidate template ignored: substitution failure [with T0 = int, T1 = double, Args = &lt;double&gt;]: no matching member function for call to 'operator()'
      auto operator()(T0&amp;&amp; t0, T1&amp;&amp; /*t1*/, Args&amp;&amp;... args) -&gt;
           ^
  main.cpp:5:7: note: candidate function template not viable: requires 1 argument, but 3 were provided
          void operator()(T&amp;&amp; /*t*/) {}
  </code></pre>
  
  <p>Is this a bug in one of the compilers or am I possibly hitting undefined behaviour somewhere?</p>