c-pretty-print.c (unary_expression): Don't print '*' for reference decay.
authorJason Merrill <jason@redhat.com>
Thu, 30 Jul 2015 19:16:23 +0000 (15:16 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 30 Jul 2015 19:16:23 +0000 (15:16 -0400)
* c-pretty-print.c (unary_expression) [INDIRECT_REF]: Don't print
'*' for reference decay.

From-SVN: r226410

gcc/c-family/ChangeLog
gcc/c-family/c-pretty-print.c

index d8953942a0a9b83d319e2d0ba41021c069c7287a..9ab95515e8891d0dc62acf7c5da684fe1973074d 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-30  Jason Merrill  <jason@redhat.com>
+
+       * c-pretty-print.c (unary_expression) [INDIRECT_REF]: Don't print
+       '*' for reference decay.
+
 2015-07-30  Marek Polacek  <polacek@redhat.com>
 
        * c-common.c (warn_tautological_cmp): Bail for float types.
index d1a0e1298b26a4badca832f38cbb4667b4d32803..90f8c3dfd141a932b49a85c5d1b217290cf7442b 100644 (file)
@@ -1774,7 +1774,13 @@ c_pretty_printer::unary_expression (tree e)
       if (code == ADDR_EXPR && TREE_CODE (TREE_OPERAND (e, 0)) != STRING_CST)
        pp_ampersand (this);
       else if (code == INDIRECT_REF)
-       pp_c_star (this);
+       {
+         tree type = TREE_TYPE (TREE_OPERAND (e, 0));
+         if (type && TREE_CODE (type) == REFERENCE_TYPE)
+           /* Reference decay is implicit, don't print anything.  */;
+         else
+           pp_c_star (this);
+       }
       else if (code == NEGATE_EXPR)
        pp_minus (this);
       else if (code == BIT_NOT_EXPR || code == CONJ_EXPR)