]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/84791 (ICE with broken OpenMP reduction clause)
authorJakub Jelinek <jakub@redhat.com>
Mon, 25 Jun 2018 17:41:34 +0000 (19:41 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 25 Jun 2018 17:41:34 +0000 (19:41 +0200)
Backported from mainline
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.

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

From-SVN: r262088

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

index 7b8d599ed5f61cbd603ac90f8d6b93ad1e8e3090..ccb09daa043e9699c2509473958be02bb42ad9ee 100644 (file)
@@ -1,6 +1,13 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       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-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/85076
index ee9eaea4ed7999f8f8c1cce9c1acf355750ea6e0..9d625fa896f31f67c3d9ff1602942e2fac2418bd 100644 (file)
@@ -5563,7 +5563,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 b69b29e407918458385f91346073807eaca1c659..b6083790bec0d461fa27dbfad251c5a9199a67fa 100644 (file)
@@ -1,6 +1,11 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/84791
+       * g++.dg/gomp/pr84791.C: New test.
+
        2018-03-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/85076
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> ();