]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport:
authorVolker Reichelt <reichelt@netcologne.de>
Wed, 2 Jan 2008 23:52:17 +0000 (23:52 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Wed, 2 Jan 2008 23:52:17 +0000 (23:52 +0000)
2007-10-31  Paolo Carlini  <pcarlini@suse.de>

PR c++/33494
* cxx-pretty-print.c (pp_cxx_typeid_expression,
pp_cxx_delete_expression): Change to static linkage.
* cxx-pretty-print.h: Adjust declarations.
* error.c (dump_expr, case SCOPE_REF, TYPEID_EXPR, DELETE_EXPR,
VEC_DELETE_EXPR, MODOP_EXPR): Forward to pp_expression.

* cxx-pretty-print.c (pp_cxx_expression, case NON_DEPENDENT_EXPR):
Fix typo.

* g++.dg/template/error35.C: New.

From-SVN: r131269

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/template/error35.C [new file with mode: 0644]

index 90982f42dc513105e1dca89737e6cfbef00c9fb5..675aca54e272ce498a045144226d84b83fcb41ef 100644 (file)
@@ -1,6 +1,18 @@
 2008-01-02  Volker Reichelt  <reichelt@netcologne.de>
 
        Backport:
+       2007-10-31  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33494
+       * cxx-pretty-print.c (pp_cxx_typeid_expression,
+       pp_cxx_delete_expression): Change to static linkage.
+       * cxx-pretty-print.h: Adjust declarations.
+       * error.c (dump_expr, case SCOPE_REF, TYPEID_EXPR, DELETE_EXPR,
+       VEC_DELETE_EXPR, MODOP_EXPR): Forward to pp_expression.
+
+       * cxx-pretty-print.c (pp_cxx_expression, case NON_DEPENDENT_EXPR):
+       Fix typo.
+
        2007-11-02  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/33495
index 4ad4d89960a5f7d2696a9a8f04d5097bd01c24fd..68bc808ff2639d519871c48009f5673817123f79 100644 (file)
@@ -43,6 +43,7 @@ static void pp_cxx_abstract_declarator (cxx_pretty_printer *, tree);
 static void pp_cxx_statement (cxx_pretty_printer *, tree);
 static void pp_cxx_template_parameter (cxx_pretty_printer *, tree);
 static void pp_cxx_cast_expression (cxx_pretty_printer *, tree);
+static void pp_cxx_typeid_expression (cxx_pretty_printer *, tree);
 \f
 
 static inline void
@@ -604,7 +605,7 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
       ::(opt) delete cast-expression
       ::(opt) delete [ ] cast-expression   */
 
-void
+static void
 pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
 {
   enum tree_code code = TREE_CODE (t);
@@ -976,7 +977,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t)
 
     case NON_DEPENDENT_EXPR:
     case MUST_NOT_THROW_EXPR:
-      pp_cxx_expression (pp, t);
+      pp_cxx_expression (pp, TREE_OPERAND (t, 0));
       break;
 
     default:
@@ -1971,7 +1972,7 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
     }
 }
 
-void
+static void
 pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
 {
   t = TREE_OPERAND (t, 0);
index 60dea036d349c06dc60487f035937e08ddb1da54..c3aa302628fd43ab0d47ea040d7ee0218eb8afb4 100644 (file)
@@ -69,9 +69,7 @@ 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_typeid_expression (cxx_pretty_printer *, tree);
 void pp_cxx_va_arg_expression (cxx_pretty_printer *, tree);
-void pp_cxx_delete_expression (cxx_pretty_printer *, tree);
 
 
 #endif /* GCC_CXX_PRETTY_PRINT_H */
index e495e430aed29ac19f62f08c631f40215ef12690..398d812cd116f172d290eb785a346a63a65c97f6 100644 (file)
@@ -1768,10 +1768,6 @@ dump_expr (tree t, int flags)
       dump_decl (TEMPLATE_PARM_DECL (t), flags & ~TFF_DECL_SPECIFIERS);
       break;
 
-    case SCOPE_REF:
-      pp_expression (cxx_pp, t);
-      break;
-
     case CAST_EXPR:
       if (TREE_OPERAND (t, 0) == NULL_TREE
          || TREE_CHAIN (TREE_OPERAND (t, 0)))
@@ -1899,17 +1895,16 @@ dump_expr (tree t, int flags)
       dump_expr (TREE_OPERAND (t, 0), flags);
       break;
 
-    case TYPEID_EXPR:
-      pp_cxx_typeid_expression (cxx_pp, t);
-      break;
-
     case VA_ARG_EXPR:
       pp_cxx_va_arg_expression (cxx_pp, t);
       break;
 
+    case SCOPE_REF:
+    case TYPEID_EXPR:
     case DELETE_EXPR:
     case VEC_DELETE_EXPR:
-      pp_cxx_delete_expression (cxx_pp, t);
+    case MODOP_EXPR:
+      pp_expression (cxx_pp, t);
       break;
 
       /*  This list is incomplete, but should suffice for now.
index 8354a6ea3cacf5a84ea29d211973d1a51bafe3f5..83535b9103f1cf032dce9dbc4d14ff8b4efb2d7c 100644 (file)
@@ -1,6 +1,11 @@
 2008-01-02  Volker Reichelt  <reichelt@netcologne.de>
 
        Backport:
+       2007-10-31  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33494
+       * g++.dg/template/error35.C: New.
+
        2007-11-02  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/33495
diff --git a/gcc/testsuite/g++.dg/template/error35.C b/gcc/testsuite/g++.dg/template/error35.C
new file mode 100644 (file)
index 0000000..d52e599
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/33494
+
+template<int> void foo(int(*f=0)()); // { dg-error "declared void|scope|erroneous-expression" }