From 9c6e2f8274d1e6a621e410dc945488aa9ff6f779 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 9 Jul 2019 00:08:27 +0200 Subject: [PATCH] re PR c++/91110 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in cp_omp_mappable_type_1, at cp/decl2.c:1421) 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. From-SVN: r273248 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl2.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/gomp/pr91110.C | 11 +++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/gomp/pr91110.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1967c9b32b5..0fcbfe507e1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-07-08 Jakub Jelinek + + PR c++/91110 + * decl2.c (cp_omp_mappable_type_1): Don't emit any note for + error_mark_node type. + 2019-07-05 Jakub Jelinek PR c++/67184 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index b415716c7dd..3aba194d824 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1416,7 +1416,7 @@ cp_omp_mappable_type_1 (tree type, bool notes) /* 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), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a78c745150b..3e24415db85 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-08 Jakub Jelinek + + PR c++/91110 + * g++.dg/gomp/pr91110.C: New test. + 2019-07-08 Segher Boessenkool PR rtl-optimization/88233 diff --git a/gcc/testsuite/g++.dg/gomp/pr91110.C b/gcc/testsuite/g++.dg/gomp/pr91110.C new file mode 100644 index 00000000000..332c99a13fc --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr91110.C @@ -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" } + ; +} -- 2.30.2