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;
}
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;
&& !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);