aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-09-15 07:55:18 -0700
committerNathan Sidwell <nathan@acm.org>2020-09-15 07:57:00 -0700
commit3304888c252f079a04ff2be95672d8c1d9a7d34f (patch)
tree33104f99bdb6ab67cb048d1650831d98a2930802 /gcc
parent8f0d743c2dee6afae5c6f861b0642b7b112a4a70 (diff)
downloadgcc-3304888c252f079a04ff2be95672d8c1d9a7d34f.zip
gcc-3304888c252f079a04ff2be95672d8c1d9a7d34f.tar.gz
gcc-3304888c252f079a04ff2be95672d8c1d9a7d34f.tar.bz2
c++: Partially revert: local externs in templates do not get template head
Turns out I didn't get OMP reductions correct. To address those I need to do some reorganization, so this patch just reverts the OMP-specific pieces of the local decl changes. gcc/cp/ * pt.c (push_template_decl_real): OMP reductions retain a template header. (tsubst_function_decl): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/pt.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c630ef5..1aea105 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6072,9 +6072,11 @@ push_template_decl_real (tree decl, bool is_friend)
if (is_primary)
retrofit_lang_decl (decl);
if (DECL_LANG_SPECIFIC (decl)
- && (!VAR_OR_FUNCTION_DECL_P (decl)
- || !ctx
- || !DECL_LOCAL_DECL_P (decl)))
+ && !(VAR_OR_FUNCTION_DECL_P (decl)
+ && DECL_LOCAL_DECL_P (decl)
+ /* OMP reductions still need a template header. */
+ && !(TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_OMP_DECLARE_REDUCTION_P (decl))))
DECL_TEMPLATE_INFO (decl) = info;
}
@@ -13712,7 +13714,8 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
gcc_assert (DECL_TEMPLATE_INFO (t) != NULL_TREE
|| DECL_LOCAL_DECL_P (t));
- if (DECL_LOCAL_DECL_P (t))
+ if (DECL_LOCAL_DECL_P (t)
+ && !DECL_OMP_DECLARE_REDUCTION_P (t))
{
if (tree spec = retrieve_local_specialization (t))
return spec;
@@ -13967,7 +13970,8 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
&& !uses_template_parms (argvec))
tsubst_default_arguments (r, complain);
}
- else if (DECL_LOCAL_DECL_P (r))
+ else if (DECL_LOCAL_DECL_P (r)
+ && !DECL_OMP_DECLARE_REDUCTION_P (r))
{
if (!cp_unevaluated_operand)
register_local_specialization (r, t);