title: `if constexpr`, inside lambda, inside pack expansion -- compiler bug?
body: <pre><code>clang version 5.0.0 (trunk 305664)
  Target: x86_64-unknown-linux-gnu
  </code></pre>
  
  <p>The following code compiles successfully:</p>
  
  <pre><code>template &lt;int... A&gt;
  void f() {
      ([](auto) {
          if constexpr (A == 0)
              return 42;
          else
              return 3.14;
      }(0), ...);
  }
  
  int main() {
      f&lt;0, 1&gt;();
  }
  </code></pre>
  
  <p>... but this one doesn't:</p>
  
  <pre><code>template &lt;int... A&gt;
  void f() {
      ([](auto...) {            // Variadic lambda
          if constexpr (A == 0)
              return 42;
          else
              return 3.14;
      }(), ...);                // No argument
  }
  
  int main() {
      f&lt;0, 1&gt;();
  }
  </code></pre>
  
  <p>... yielding:</p>
  
  <pre><code>&lt;source&gt;:7:13: error: 'auto' in return type deduced as 'double' here but deduced as 'int' in earlier return statement
              return 3.14;
              ^
  &lt;source&gt;:3:6: note: in instantiation of function template specialization 'f()::(anonymous class)::operator()&lt;&gt;' requested here
      ([](auto...) {            // Variadic lambda
       ^
  &lt;source&gt;:12:5: note: in instantiation of function template specialization 'f&lt;0, 1&gt;' requested here
      f&lt;0, 1&gt;();
      ^
  </code></pre>
  
  <p>I wouldn't expect different behaviours between an empty argument pack and a dummy argument.</p>
  
  <p>Is there a reason to this discrepancy, or is this a compiler bug?</p>