[C++ PATCH] Fix 2 diagnostic issues (PR c++/34394, c++/34395)

Jakub Jelinek jakub@redhat.com
Mon Dec 10 14:08:00 GMT 2007


Hi!

These two patches fixes some minor diagnostic issues.
Regtested on x86_64-linux, ok for trunk?

	Jakub
-------------- next part --------------
2007-12-10  Jakub Jelinek  <jakub@redhat.com>

	PR c++/34394
	* error.c (dump_expr): Handle ABS_EXPR.

	* g++.dg/other/error22.C: New test.

--- gcc/cp/error.c.jj	2007-12-03 21:34:34.000000000 +0100
+++ gcc/cp/error.c	2007-12-10 14:37:14.000000000 +0100
@@ -2054,6 +2054,7 @@ dump_expr (tree t, int flags)
     case DELETE_EXPR:
     case VEC_DELETE_EXPR:
     case MODOP_EXPR:
+    case ABS_EXPR:
       pp_expression (cxx_pp, t);
       break;
 
--- gcc/testsuite/g++.dg/other/error22.C.jj	2007-12-10 14:40:20.000000000 +0100
+++ gcc/testsuite/g++.dg/other/error22.C	2007-12-10 14:39:18.000000000 +0100
@@ -0,0 +1,9 @@
+// PR c++/34394
+// { dg-do compile }
+
+extern double fabs (double);
+
+void foo (double x)
+{
+  fabs (x) ();	// { dg-error "__builtin_abs" }
+}
-------------- next part --------------
2007-12-10  Jakub Jelinek  <jakub@redhat.com>

	PR c++/34395
	* error.c (dump_type_prefix, dump_type_suffix): Handle
	TYPE_PACK_EXPANSION.

	* g++.dg/cpp0x/error1.C: New test.

--- gcc/cp/error.c.jj	2007-12-10 14:37:14.000000000 +0100
+++ gcc/cp/error.c	2007-12-10 14:54:58.000000000 +0100
@@ -611,6 +611,7 @@ dump_type_prefix (tree t, int flags)
     case VECTOR_TYPE:
     case TYPEOF_TYPE:
     case DECLTYPE_TYPE:
+    case TYPE_PACK_EXPANSION:
       dump_type (t, flags);
       pp_base (cxx_pp)->padding = pp_before;
       break;
@@ -708,6 +709,7 @@ dump_type_suffix (tree t, int flags)
     case VECTOR_TYPE:
     case TYPEOF_TYPE:
     case DECLTYPE_TYPE:
+    case TYPE_PACK_EXPANSION:
       break;
 
     default:
--- gcc/testsuite/g++.dg/cpp0x/error1.C.jj	2007-12-10 14:57:14.000000000 +0100
+++ gcc/testsuite/g++.dg/cpp0x/error1.C	2007-12-10 14:59:33.000000000 +0100
@@ -0,0 +1,11 @@
+// PR c++/34395
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template<int... N> void foo (int... x[N])	// { dg-error "int \\\[N\\\]\\.\\.\\. x" }
+{
+  struct A
+  {
+    A () { x; }		// { dg-error "use of parameter from containing function" }
+  };
+}


More information about the Gcc-patches mailing list