I've backported Jakub's patch to openacc-gcc-9-branch.

Andrew

On 08/07/2019 23:10, Jakub Jelinek wrote:
On Thu, Jul 04, 2019 at 12:44:32PM +0100, Andrew Stubbs wrote:
On 03/07/2019 18:58, Jason Merrill wrote:
OK, thanks.

Committed.

This broke following testcase.
error_mark_node type isn't really incomplete, it is errorneous, doesn't have
TYPE_MAIN_DECL and we should have diagnosed it earlier, so it makes no sense
to emit extra explanation messages.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk.

2019-07-08  Jakub Jelinek  <ja...@redhat.com>

        PR c++/91110
        * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
        error_mark_node type.

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

--- gcc/cp/decl2.c.jj   2019-07-04 23:39:02.579106113 +0200
+++ gcc/cp/decl2.c      2019-07-08 13:22:52.552898230 +0200
@@ -1416,7 +1416,7 @@ cp_omp_mappable_type_1 (tree type, bool
    /* Mappable type has to be complete.  */
    if (type == error_mark_node || !COMPLETE_TYPE_P (type))
      {
-      if (notes)
+      if (notes && type != error_mark_node)
        {
          tree decl = TYPE_MAIN_DECL (type);
          inform ((decl ? DECL_SOURCE_LOCATION (decl) : input_location),
--- gcc/testsuite/g++.dg/gomp/pr91110.C.jj      2019-07-08 13:29:43.803163534 
+0200
+++ gcc/testsuite/g++.dg/gomp/pr91110.C 2019-07-08 13:29:17.550593456 +0200
@@ -0,0 +1,11 @@
+// PR c++/91110
+// { dg-do compile }
+
+void
+foo ()
+{
+  X b[2];      // { dg-error "'X' was not declared in this scope" }
+  b[0] = 1;    // { dg-error "'b' was not declared in this scope" }
+  #pragma omp target map(to: b)        // { dg-error "'b' does not have a mappable 
type in 'map' clause" }
+  ;
+}


        Jakub


Reply via email to