diff mbox

C++ PATCH for c++/63658 (reference non-type template parameters)

Message ID 546E8B88.3090900@redhat.com
State New
Headers show

Commit Message

Jason Merrill Nov. 21, 2014, 12:47 a.m. UTC
My patch for c++/58606 changed the internal representation of reference 
template arguments to include the dereference in some places, but not 
enough.

Tested x86_64-cp-linux-gnu, applying to trunk and 4.9.
diff mbox

Patch

commit fea8bb6d4f45b8b1388001e59ad73b3ba63f41ea
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Nov 20 09:37:50 2014 -0500

    	* error.c (dump_expr): Avoid printing (*&i) for references.

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 76f86cb..7d79771 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2299,7 +2299,13 @@  dump_expr (cxx_pretty_printer *pp, tree t, int flags)
 			    TREE_TYPE (ttype)))
 	  {
 	    if (TREE_CODE (ttype) == REFERENCE_TYPE)
-	      dump_unary_op (pp, "*", t, flags);
+	      {
+		STRIP_NOPS (op);
+		if (TREE_CODE (op) == ADDR_EXPR)
+		  dump_expr (pp, TREE_OPERAND (op, 0), flags);
+		else
+		  dump_unary_op (pp, "*", t, flags);
+	      }
 	    else
 	      dump_unary_op (pp, "&", t, flags);
 	  }