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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-10-23
                 CC|                            |jason at gcc dot gnu.org
      Known to work|                            |5.0
     Ever confirmed|0                           |1

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Actually the original problem is fixed on trunk too (but gives a different
error now), so maybe it is the same and can be reduced to:

int main()
{
  int a{5};
  [&a](auto z) -> void {
    decltype(a) b = a;
  }(1);
}

l.cc: In instantiation of ‘main()::<lambda(auto:1)> [with auto:1 = int]’:
l.cc:6:6:   required from here
l.cc:5:17: error: ‘a’ was not declared in this scope
     decltype(a) b = a;
                 ^

The error goes away if the lambda doesn't have a trailing-return-type, or if
it's not a generic lambda.

Jason, is it worth fixing this on the branch? It only affects C++14 mode.

Reply via email to