OSDN Git Service

PR c++/39095
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 4 Feb 2009 16:50:22 +0000 (16:50 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 4 Feb 2009 16:50:22 +0000 (16:50 +0000)
* operators.def: Use COMPONENT_REF code for ->/pt operator again,
remove ./dt operator.
* mangle.c (write_expression): Handle COMPONENT_REF after handling
ADDR_EXPR, for COMPONENT_REF without ARROW_EXPR inside of it
write_string ("dt") instead of using operators.def.

* g++.dg/abi/mangle31.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143933 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/cp/operators.def
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/mangle31.C [new file with mode: 0644]

index c2765da..2a08d8b 100644 (file)
@@ -1,3 +1,12 @@
+2009-02-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/39095
+       * operators.def: Use COMPONENT_REF code for ->/pt operator again,
+       remove ./dt operator.
+       * mangle.c (write_expression): Handle COMPONENT_REF after handling
+       ADDR_EXPR, for COMPONENT_REF without ARROW_EXPR inside of it
+       write_string ("dt") instead of using operators.def.
+
 2009-02-03  Jason Merrill  <jason@redhat.com>
 
        * typeck.c (cp_build_unary_op): Only complain about taking address
index a7b4662..f51136a 100644 (file)
@@ -2298,20 +2298,6 @@ write_expression (tree expr)
            write_template_args (template_args);
        }
     }
-  else if (code == COMPONENT_REF)
-    {
-      tree ob = TREE_OPERAND (expr, 0);
-
-      if (TREE_CODE (ob) == ARROW_EXPR)
-       {
-         code = ARROW_EXPR;
-         ob = TREE_OPERAND (ob, 0);
-       }
-
-      write_string (operator_name_info[(int)code].mangled_name);
-      write_expression (ob);
-      write_member_name (TREE_OPERAND (expr, 1));
-    }
   else
     {
       int i;
@@ -2334,6 +2320,23 @@ write_expression (tree expr)
          code = TREE_CODE (expr);
        }
 
+      if (code == COMPONENT_REF)
+       {
+         tree ob = TREE_OPERAND (expr, 0);
+
+         if (TREE_CODE (ob) == ARROW_EXPR)
+           {
+             write_string (operator_name_info[(int)code].mangled_name);
+             ob = TREE_OPERAND (ob, 0);
+           }
+         else
+           write_string ("dt");
+
+         write_expression (ob);
+         write_member_name (TREE_OPERAND (expr, 1));
+         return;
+       }
+
       /* If it wasn't any of those, recursively expand the expression.  */
       write_string (operator_name_info[(int) code].mangled_name);
 
index 20c74d8..c63ce3f 100644 (file)
@@ -125,8 +125,7 @@ DEF_SIMPLE_OPERATOR ("&&", TRUTH_ANDIF_EXPR, "aa", 2)
 DEF_SIMPLE_OPERATOR ("||", TRUTH_ORIF_EXPR, "oo", 2)
 DEF_SIMPLE_OPERATOR (",", COMPOUND_EXPR, "cm", 2)
 DEF_SIMPLE_OPERATOR ("->*", MEMBER_REF, "pm", 2)
-DEF_SIMPLE_OPERATOR ("->", ARROW_EXPR, "pt", 2)
-DEF_SIMPLE_OPERATOR (".", COMPONENT_REF, "dt", 2)
+DEF_SIMPLE_OPERATOR ("->", COMPONENT_REF, "pt", 2)
 DEF_SIMPLE_OPERATOR ("[]", ARRAY_REF, "ix", 2)
 DEF_SIMPLE_OPERATOR ("++", POSTINCREMENT_EXPR, "pp", 2)
 DEF_SIMPLE_OPERATOR ("--", POSTDECREMENT_EXPR, "mm", 2)
index 25dedae..37b5783 100644 (file)
@@ -1,3 +1,8 @@
+2009-02-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/39095
+       * g++.dg/abi/mangle31.C: New test.
+
 2009-02-03  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/29129
diff --git a/gcc/testsuite/g++.dg/abi/mangle31.C b/gcc/testsuite/g++.dg/abi/mangle31.C
new file mode 100644 (file)
index 0000000..4be2e0b
--- /dev/null
@@ -0,0 +1,35 @@
+// PR c++/39095
+// { dg-do compile }
+
+struct B
+{
+  int b;
+};
+
+struct A
+{
+  B *operator->();
+  A ();
+  B b;
+};
+
+A::A ()
+{
+}
+
+B *
+A::operator->()
+{
+  return &b;
+}
+
+A a;
+
+int
+foo ()
+{
+  return a->b;
+}
+
+// { dg-final { scan-assembler "_ZN1AptEv" } }
+// { dg-final { scan-assembler-not "_ZN1AdtEv" } }