aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-07-21 09:38:59 +0200
committerJakub Jelinek <jakub@redhat.com>2021-07-21 09:38:59 +0200
commitaea199f96cf116ba4c81426207acde371556610c (patch)
tree0ee5e809cce7042bed7dee5e75f5f361f00808c5 /gcc/cp/semantics.c
parentb3d4011ba10275fbd5d6ec5a16d5aaebbdfb5d3c (diff)
downloadgcc-aea199f96cf116ba4c81426207acde371556610c.zip
gcc-aea199f96cf116ba4c81426207acde371556610c.tar.gz
gcc-aea199f96cf116ba4c81426207acde371556610c.tar.bz2
c++: Ensure OpenMP reduction with reference type references complete type [PR101516]
The following testcase ICEs because we haven't verified if reduction decl has reference type that TREE_TYPE of the reference is a complete type, require_complete_type on the decl doesn't ensure that. 2021-07-21 Jakub Jelinek <jakub@redhat.com> PR c++/101516 * semantics.c (finish_omp_reduction_clause): Also call complete_type_or_else and return true if it fails. * g++.dg/gomp/pr101516.C: New test.
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index b97dc1f..331daf8 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -6070,7 +6070,8 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
if (!processing_template_decl)
{
t = require_complete_type (t);
- if (t == error_mark_node)
+ if (t == error_mark_node
+ || !complete_type_or_else (oatype, NULL_TREE))
return true;
tree size = size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (oatype),
TYPE_SIZE_UNIT (type));