diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-09-16 11:04:19 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-09-16 12:16:11 -0700 |
commit | 8155316c6fc23045e8e056e91449a6e9863c357f (patch) | |
tree | eb49f081f6ba90d0eda09fd14b4861a1af0ac019 /libgomp | |
parent | d1339b519ae8cc4ae550baa127a21d8350462837 (diff) | |
download | gcc-8155316c6fc23045e8e056e91449a6e9863c357f.zip gcc-8155316c6fc23045e8e056e91449a6e9863c357f.tar.gz gcc-8155316c6fc23045e8e056e91449a6e9863c357f.tar.bz2 |
c++: local-scope OMP UDR reductions have no template head
This corrects the earlier problems with removing the template header
from local omp reductions. And it uncovered a latent bug. When we
tsubst such a decl, we immediately tsubst its body.
cp_check_omp_declare_reduction gets a success return value to gate
that instantiation.
udr-2.C got a further error, as the omp checking machinery doesn't
appear to turn the reduction into an error mark when failing. I
didn't dig into that further. udr-3.C appears to have been invalid
and accidentally worked.
gcc/cp/
* cp-tree.h (cp_check_omp_declare_reduction): Return bool.
* semantics.c (cp_check_omp_declare_reduction): Return true on for
success.
* pt.c (push_template_decl_real): OMP reductions do not get a
template header.
(tsubst_function_decl): Remove special casing for local decl omp
reductions.
(tsubst_expr): Call instantiate_body for a local omp reduction.
(instantiate_body): Add nested_p parm, and deal with such
instantiations.
(instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
instantiate_body call.
gcc/testsuite/
* g++.dg/gomp/udr-2.C: Add additional expected error.
libgomp/
* testsuite/libgomp.c++/udr-3.C: Add missing ctor.
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/testsuite/libgomp.c++/udr-3.C | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/udr-3.C b/libgomp/testsuite/libgomp.c++/udr-3.C index 74a0138..0c45cb8 100644 --- a/libgomp/testsuite/libgomp.c++/udr-3.C +++ b/libgomp/testsuite/libgomp.c++/udr-3.C @@ -86,6 +86,7 @@ struct W { int v; W () : v (6) {} + W (int i) : v (i) {} ~W () {} }; |