Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 234970) +++ cp/semantics.c (working copy) @@ -3276,7 +3276,7 @@ process_outer_var_ref (tree decl, tsubst_flags_t c tree initializer = convert_from_reference (decl); /* Mark it as used now even if the use is ill-formed. */ - if (!mark_used (decl, complain) && !(complain & tf_error)) + if (!mark_used (decl, complain)) return error_mark_node; bool saw_generic_lambda = false; Index: testsuite/g++.dg/cpp0x/auto47.C =================================================================== --- testsuite/g++.dg/cpp0x/auto47.C (revision 0) +++ testsuite/g++.dg/cpp0x/auto47.C (working copy) @@ -0,0 +1,8 @@ +// PR c++/70540 +// { dg-do compile { target c++11 } } + +void +foo () +{ + auto f = [&] { return f; }; // { dg-error "before deduction" } +}