diff mbox

[C++] PR 70540 ("[4.9/5/6 Regression] ICE on invalid code in cxx_incomplete_type_diagnostic...")

Message ID 570F67DC.9030700@oracle.com
State New
Headers show

Commit Message

Paolo Carlini April 14, 2016, 9:50 a.m. UTC
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.

Thanks,
Paolo.

/////////////////////////////
/cp
2016-04-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70540
	* semantics.c (process_outer_var_ref): Unconditionally return
	error_mark_node when mark_used returns false.

/testsuite
2016-04-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70540
	* g++.dg/cpp0x/auto47.C: New.

Comments

Paolo Carlini April 21, 2016, 2:21 p.m. UTC | #1
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.
Jason Merrill April 21, 2016, 4:49 p.m. UTC | #2
OK for trunk and 6.2.

Jason
diff mbox

Patch

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" }
+}