re PR c++/31748 (bad diagnostic for invalid private clause)
authorJakub Jelinek <jakub@redhat.com>
Mon, 2 Jul 2007 12:59:49 +0000 (14:59 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 2 Jul 2007 12:59:49 +0000 (14:59 +0200)
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.

From-SVN: r126201

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr31748.C [new file with mode: 0644]

index aeb0e5c720a13a7474f6d70416102de4852a3baf..b25e051187baf5dcd3286a8be79ed3945f0483e2 100644 (file)
@@ -1,3 +1,9 @@
+2007-07-02  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.
+
 2007-07-01  Ollie Wild  <aaw@google.com>
 
        * name-lookup.c (ambiguous_decl): Fix case when new->value is hidden.
index dc4a9f7a9f9367221420b09c3083377f0cc703ea..6b0d4073b0ad08e8842c713c89d6a283789c7b89 100644 (file)
@@ -3377,14 +3377,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
index fee89cf8df61607414631a41629de2b1c4ffea44..a4cfc1f017a89af26359016cf316125c46d4feee 100644 (file)
@@ -3,6 +3,9 @@
        * g++.dg/opt/nrv12.C: New test.
        * gcc.target/i386/nrv1.c: New test.
 
+       PR c++/31748
+       * g++.dg/gomp/pr31748.C: New test.
+
 2007-07-02  Ira Rosen  <irar@il.ibm.com>
  
        PR tree-optimization/32230
diff --git a/gcc/testsuite/g++.dg/gomp/pr31748.C b/gcc/testsuite/g++.dg/gomp/pr31748.C
new file mode 100644 (file)
index 0000000..516978d
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/31748
+
+struct A;
+
+void
+foo ()
+{
+#pragma omp parallel private(A)        // { dg-error "struct A.*is not a variable" }
+  ;
+}