dimanche 25 septembre 2016

Empty lambda capture still shadows outer scope?

An empty lambda capture list [] creates a plain function without a closure object. Why, then, given this example:

int main(int argc, const char *argv[]) {
  auto _foo = [] (int argc) {
      return argc - 1;
  };
  return _foo(argc);
}

does gcc (4.8.5 and 5.4.0) warn that the argc of the lambda shadows the argc variable of the outer scope?

Aucun commentaire:

Enregistrer un commentaire