This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH, 3.4/4.0/4.1] fix 24052


This is a simple failure to handle the address-of-label extension in the C++ errors.

Bootstrapped/regtested i686-pc-linux-gnu, ok for 4.1/4.0/3.4?

Paolo
2005-10-10  Paolo Bonzini  <bonzini@gnu.org>

	* cp/error.c (dump_expr): Pass LABEL_DECL to dump_decl.  Print
	an ADDR_EXPR of a LABEL_DECL as &&.

testsuite:
2005-10-10  Paolo Bonzini  <bonzini@gnu.org>

	* g++.dg/ext/label5.C: New.

Index: cp/error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/error.c,v
retrieving revision 1.292
diff -p -u -u -r1.292 error.c
--- cp/error.c	15 Sep 2005 11:27:12 -0000	1.292
+++ cp/error.c	7 Oct 2005 07:18:37 -0000
@@ -1299,6 +1299,7 @@ dump_expr (tree t, int flags)
     case FUNCTION_DECL:
     case TEMPLATE_DECL:
     case NAMESPACE_DECL:
+    case LABEL_DECL:
     case OVERLOAD:
     case IDENTIFIER_NODE:
       dump_decl (t, (flags & ~TFF_DECL_SPECIFIERS) | TFF_NO_FUNCTION_ARGUMENTS);
@@ -1541,6 +1542,8 @@ dump_expr (tree t, int flags)
 	  || (TREE_TYPE (t)
 	      && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE))
 	dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
+      else if (TREE_CODE (TREE_OPERAND (t, 0)) == LABEL_DECL)
+	dump_unary_op ("&&", t, flags);
       else
 	dump_unary_op ("&", t, flags);
       break;
Index: testsuite/g++.dg/ext/label5.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/parse/label5.C,v
diff -N label5.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/g++.dg/parse/label5.C	11 Oct 2005 16:16:38 -0000
@@ -0,0 +1,7 @@
+// { dg-options "" }
+// PR c++/24052
+
+struct A { };
+int main() { b: A() && && b; } // { dg-error "A\\(\\) && && *b" }
+
+// { dg-error "candidate" "additional" { target *-*-* } 5 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]