Message ID | 570F67DC.9030700@oracle.com |
---|---|
State | New |
Headers | show |
Hi, On 14/04/2016 11:50, Paolo Carlini wrote: > Hi, > > in this regression we ICE during error recovery after an additional > redundant error message. I think it's one of those cases (we have got > quite a few elsewhere, in semantics.c too) when it's better to > immediately return error_mark_node when mark_used returns false, even > if we aren't in a SFINAE context. To be sure, I double checked that in > those cases mark_used certainly issues an error, thus we aren't > risking creating accepts-invalid bugs, it's only matter of fine tuning > error recovery. Tested x86_64-linux. Pinging this... for trunk and maybe for the branch too when it reopens if everything goes well? https://gcc.gnu.org/ml/gcc-patches/2016-04/msg00644.html Thanks, Paolo.
OK for trunk and 6.2. Jason
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" } +}