https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61402

--- Comment #1 from Thibaut LUTZ <thibaut.lutz at googlemail dot com> ---
I forgot to add that separating declaration and invocation seems to solve the
problem: 

--8<----8<----8<----8<----8<----8<--
#include <iostream>

template<typename T>
void foo(T t) {
  using namespace std;
  cout << endl << "par t = " << t << endl;
  auto test = [ i = ++t ](T v) {
      cout << "cap i = ++t = " << i << endl
           << "arg v = " << v << endl;
  };
  test(t);
}

int main(){
  foo(3.14f); // works OK
  foo(0);     // works OK
  foo('a');   // works OK
  foo(false); // works OK
}
--8<----8<----8<----8<----8<----8<--

Reply via email to