diff mbox

C++ PATCH for c++/47132 (mangling |=)

Message ID 4DDFF9CC.3030108@redhat.com
State New
Headers show

Commit Message

Jason Merrill May 27, 2011, 7:21 p.m. UTC
Pretty straightforward, we just didn't handle the compound assignment 
operators before.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit 5aba1b056466d0713a6479a364a96504bcfc93b9
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 27 13:48:39 2011 -0400

    	PR c++/47132
    	* mangle.c (write_expression): Handle MODOP_EXPR.

diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index c1f3b44..27ef374 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2599,6 +2599,15 @@  write_expression (tree expr)
       write_unqualified_id (fn);
       write_template_args (TREE_OPERAND (expr, 1));
     }
+  else if (TREE_CODE (expr) == MODOP_EXPR)
+    {
+      enum tree_code subop = TREE_CODE (TREE_OPERAND (expr, 1));
+      const char *name = (assignment_operator_name_info[(int) subop]
+			  .mangled_name);
+      write_string (name);
+      write_expression (TREE_OPERAND (expr, 0));
+      write_expression (TREE_OPERAND (expr, 2));
+    }
   else
     {
       int i, len;
diff --git a/gcc/testsuite/g++.dg/abi/mangle47.C b/gcc/testsuite/g++.dg/abi/mangle47.C
new file mode 100644
index 0000000..2c1b636
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle47.C
@@ -0,0 +1,11 @@ 
+// PR c++/47132
+// { dg-options -std=c++0x }
+// { dg-final { scan-assembler "_Z1fIiEDToRfp_Li1EET_" } }
+
+template <typename T>
+auto f (T t) -> decltype(t |= 1);
+
+int main()
+{
+  f(1);
+}