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]

[PATCH] Backport diagnostic fixes to 4.2 branch part [1/5]: PR33463


Here's a handful of backports from patches from mainline to the 4.2 branch.
The bugs are all diagnostic regressions of the form
#'whatever_expr' not supported by dump_whatever#
All original patches were provided by Paolo Carlini.

The patches are sometimes dependent on each other. I'm posting
them in the order in which they are supposed to be applied.
They were all bootstrapped and regtested together on i686-pc-linux-gnu.
Ok for 4.2 branch?

The first bug - http://gcc.gnu.org/PR33463 - deals with
'typeid_expr' not supported by dump_expr.

The original patch is here:
http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01470.html

Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for 4.2 branch?

Regards,
Volker


:ADDPATCH C++:


2008-01-01  Volker Reichelt  <reichelt@netcologne.de>

	Backport:
	2007-09-18  Paolo Carlini  <pcarlini@suse.de>
 
	PR c++/33463
	* cxx-pretty-print.c (pp_cxx_postfix_expression): Split
	out case TYPEID_EXPR to...
	(pp_cxx_typeid_expression): ... here; use pp_cxx_left_paren
	and pp_cxx_right_paren.
	* cxx-pretty-print.h (pp_cxx_typeid_expression): Declare.
	* error.c (dump_expr): Use it.

===================================================================
--- gcc/cp/cxx-pretty-print.c	(revision 128581)
+++ gcc/cp/cxx-pretty-print.c	(revision 128582)
@@ -512,14 +512,7 @@
       break;
 
     case TYPEID_EXPR:
-      t = TREE_OPERAND (t, 0);
-      pp_cxx_identifier (pp, "typeid");
-      pp_left_paren (pp);
-      if (TYPE_P (t))
-	pp_cxx_type_id (pp, t);
-      else
-	pp_cxx_expression (pp, t);
-      pp_right_paren (pp);
+      pp_cxx_typeid_expression (pp, t);
       break;
 
     case PSEUDO_DTOR_EXPR:
@@ -1968,6 +1961,19 @@
     }
 }
 
+void
+pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
+{
+  t = TREE_OPERAND (t, 0);
+  pp_cxx_identifier (pp, "typeid");
+  pp_cxx_left_paren (pp);
+  if (TYPE_P (t))
+    pp_cxx_type_id (pp, t);
+  else
+    pp_cxx_expression (pp, t);
+  pp_cxx_right_paren (pp);
+}
+
 
 typedef c_pretty_print_fn pp_fun;
 
===================================================================
--- gcc/cp/cxx-pretty-print.h	(revision 128581)
+++ gcc/cp/cxx-pretty-print.h	(revision 128582)
@@ -69,6 +69,7 @@
 
 void pp_cxx_declaration (cxx_pretty_printer *, tree);
 void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree);
+void pp_cxx_typeid_expression (cxx_pretty_printer *, tree);
 
 
 #endif /* GCC_CXX_PRETTY_PRINT_H */
===================================================================
--- gcc/cp/error.c	(revision 128581)
+++ gcc/cp/error.c	(revision 128582)
@@ -1893,6 +1893,10 @@
       dump_expr (TREE_OPERAND (t, 0), flags);
       break;
 
+    case TYPEID_EXPR:
+      pp_cxx_typeid_expression (cxx_pp, t);
+      break;
+
       /*  This list is incomplete, but should suffice for now.
 	  It is very important that `sorry' does not call
 	  `report_error_function'.  That could cause an infinite loop.  */

===================================================================

2008-01-01  Volker Reichelt  <reichelt@netcologne.de>

	Backport:
	2007-09-18  Paolo Carlini  <pcarlini@suse.de>
 
	PR c++/33463
	* g++.dg/rtti/typeid6.C: New.

===================================================================
--- gcc/testsuite/g++.dg/rtti/typeid6.C	(revision 0)
+++ gcc/testsuite/g++.dg/rtti/typeid6.C	(revision 128582)
@@ -0,0 +1,11 @@
+// PR c++/33463
+
+namespace std
+{
+  class type_info {};
+}
+
+template<int> void foo()
+{
+  !typeid(void); // { dg-error "!typeid\\(void\\)|candidates" }
+}
===================================================================


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