Patchwork C++ PATCH for c++/50059

login
register
mail settings
Submitter Jason Merrill
Date Aug. 13, 2011, 8:10 p.m.
Message ID <4E46DA53.1070007@redhat.com>
Download mbox | patch
Permalink /patch/109944/
State New
Headers show

Comments

Jason Merrill - Aug. 13, 2011, 8:10 p.m.
We were failing to print MODIFY_EXPR properly.  I'm surprised that 
didn't turn up before now.

Tested x86_64-pc-linux-gnu, applied to trunk.

Patch

commit f8556f7a8d1bbf620edca19bd3d350ad7b82df7c
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Aug 13 03:01:09 2011 -0400

    	PR c++/50059
    	* error.c (dump_expr): Handle MODIFY_EXPR properly.

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 3374488..48c0593 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1868,6 +1868,10 @@  dump_expr (tree t, int flags)
 
     case INIT_EXPR:
     case MODIFY_EXPR:
+      dump_binary_op (assignment_operator_name_info[(int)NOP_EXPR].name,
+		      t, flags);
+      break;
+
     case PLUS_EXPR:
     case MINUS_EXPR:
     case MULT_EXPR:
diff --git a/gcc/testsuite/g++.dg/diagnostic/expr1.C b/gcc/testsuite/g++.dg/diagnostic/expr1.C
new file mode 100644
index 0000000..5651030
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/expr1.C
@@ -0,0 +1,9 @@ 
+// PR c++/50059
+
+int i;
+struct A { };
+void f(A);
+void g()
+{
+  f(i = 0);			// { dg-error "i = 0" }
+}