]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Sep 2007 15:38:02 +0000 (15:38 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Sep 2007 15:38:02 +0000 (15:38 +0000)
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.

/testsuite
2007-09-18  Paolo Carlini  <pcarlini@suse.de>

PR c++/33463
* g++.dg/rtti/typeid6.C: New.

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

gcc/cp/ChangeLog
gcc/cp/cxx-pretty-print.c
gcc/cp/cxx-pretty-print.h
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/rtti/typeid6.C [new file with mode: 0644]

index c0610b0ffbfff6f59c94134f554e1b97ba3ea65a..504a0c36d285f0f28cd00ad9419b7c630d629da1 100644 (file)
@@ -1,3 +1,13 @@
+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.
+
 2007-09-18  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/33464
index 156f579b6b51df7b01465bcffea4396b75b87e77..a73a052572b979b509c4760c0bf9490f0ae4a30e 100644 (file)
@@ -571,14 +571,7 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
       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:
@@ -2146,6 +2139,19 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
     }
 }
 
+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);
+}
+
 void
 pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t)
 {
index 2ae834f2be05047c26f02b2f7bb389e458ae0175..f399feafaa4d4307eec56285438592df87aef8eb 100644 (file)
@@ -70,5 +70,6 @@ void pp_cxx_separate_with (cxx_pretty_printer *, int);
 void pp_cxx_declaration (cxx_pretty_printer *, tree);
 void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree);
 void pp_cxx_trait_expression (cxx_pretty_printer *, tree);
+void pp_cxx_typeid_expression (cxx_pretty_printer *, tree);
 
 #endif /* GCC_CXX_PRETTY_PRINT_H */
index b68df74f83e9bbef364b8d9637f2a049f428d1d0..1854fd6888cf7536ee3580c8554daacf75c3737d 100644 (file)
@@ -2058,6 +2058,10 @@ dump_expr (tree t, int flags)
       pp_cxx_trait_expression (cxx_pp, t);
       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.  */
index 882780f2e1edab734214e024b87e4b1faacbcee5..fe8802588e810c7e02f1104e1199dcce8987b5b5 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-18  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33463
+       * g++.dg/rtti/typeid6.C: New.
+
 2007-09-18  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/33464
diff --git a/gcc/testsuite/g++.dg/rtti/typeid6.C b/gcc/testsuite/g++.dg/rtti/typeid6.C
new file mode 100644 (file)
index 0000000..18709b4
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/33463
+
+namespace std
+{
+  class type_info {};
+}
+
+template<int> void foo()
+{
+  !typeid(void); // { dg-error "!typeid\\(void\\)|candidates" }
+}