Blob Blame History Raw
2007-05-01  Jakub Jelinek  <jakub@redhat.com>

	PR c++/31748
	* semantics.c (finish_omp_clauses): Use %qD instead of %qE for
	DECL_P in not a variable and appears more than once error messages.

	* g++.dg/gomp/pr31748.C: New test.

--- gcc/cp/semantics.c.jj	2007-04-26 09:30:58.000000000 +0200
+++ gcc/cp/semantics.c	2007-05-01 14:22:58.000000000 +0200
@@ -3376,14 +3376,17 @@ finish_omp_clauses (tree clauses)
 	    {
 	      if (processing_template_decl)
 		break;
-	      error ("%qE is not a variable in clause %qs", t, name);
+	      if (DECL_P (t))
+		error ("%qD is not a variable in clause %qs", t, name);
+	      else
+		error ("%qE is not a variable in clause %qs", t, name);
 	      remove = true;
 	    }
 	  else if (bitmap_bit_p (&generic_head, DECL_UID (t))
 		   || bitmap_bit_p (&firstprivate_head, DECL_UID (t))
 		   || bitmap_bit_p (&lastprivate_head, DECL_UID (t)))
 	    {
-	      error ("%qE appears more than once in data clauses", t);
+	      error ("%qD appears more than once in data clauses", t);
 	      remove = true;
 	    }
 	  else
--- gcc/testsuite/g++.dg/gomp/pr31748.C.jj	2007-05-01 14:26:13.000000000 +0200
+++ gcc/testsuite/g++.dg/gomp/pr31748.C	2007-05-01 14:26:07.000000000 +0200
@@ -0,0 +1,10 @@
+// PR c++/31748
+
+struct A;
+
+void
+foo ()
+{
+#pragma omp parallel private(A)	// { dg-error "struct A.*is not a variable" }
+  ;
+}