re PR c++/84791 (ICE with broken OpenMP reduction clause)
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Mar 2018 18:38:36 +0000 (20:38 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Mar 2018 18:38:36 +0000 (20:38 +0200)
PR c++/84791
* semantics.c (finish_omp_reduction_clause): If
OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
even if processing_template_decl.

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

From-SVN: r258981

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

index 77c729c979e6ee4a7d0b6394c056845ee1490587..13b2435109a9eacb4c620ede834d9c0ea6485a4c 100644 (file)
@@ -1,3 +1,10 @@
+2018-03-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/84791
+       * semantics.c (finish_omp_reduction_clause): If
+       OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
+       even if processing_template_decl.
+
 2018-03-29  David Malcolm  <dmalcolm@redhat.com>
 
        PR c++/84269
index 035e3951574894ead12719b0d3054de031512879..eef9e2f645df9208997e21d068fa6c9bbde8efae 100644 (file)
@@ -5623,7 +5623,11 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
       return false;
     }
   else if (processing_template_decl)
-    return false;
+    {
+      if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) == error_mark_node)
+       return true;
+      return false;
+    }
 
   tree id = OMP_CLAUSE_REDUCTION_PLACEHOLDER (c);
 
index e17846e9c488c9b411e2d9129c28adfff7c8a4f1..31d0f011d5a6a062d9bd2198e96c6cab618280e4 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/84791
+       * g++.dg/gomp/pr84791.C: New test.
+
 2018-03-30  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/84931
diff --git a/gcc/testsuite/g++.dg/gomp/pr84791.C b/gcc/testsuite/g++.dg/gomp/pr84791.C
new file mode 100644 (file)
index 0000000..4e6d3b8
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/84791
+// { dg-do compile }
+
+typedef int I;
+
+template <int>
+void
+foo ()
+{
+  I i;
+  #pragma omp parallel reduction (I::I: i)     // { dg-error "'I' is not a class, namespace, or enumeration" "" { target c++11 } }
+    ;                                          // { dg-error "'I' is not a class or namespace" "" { target c++98_only } .-1 }
+}
+
+template void foo<0> ();