2017-10-10 Jason Merrill <jason@redhat.com>
+ * typeck.c (condition_conversion): Assert !processing_template_decl.
+ * semantics.c (finish_omp_clauses): Don't
+ fold_build_cleanup_point_expr if processing_template_decl.
+ (outer_var_p): A temporary can't be from an outer scope.
+ * pt.c (type_dependent_expression_p): Fix dependency checking of
+ functions without DECL_TEMPLATE_INFO.
+ (instantiate_decl): Use lss_copy.
+ * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
+
* typeck.c (check_return_expr): Check non-dependent conversion in
templates.
* constraint.cc (check_function_concept): Don't complain about an
synthesize_method (d);
else if (TREE_CODE (d) == FUNCTION_DECL)
{
- hash_map<tree, tree> *saved_local_specializations;
- tree block = NULL_TREE;
-
- /* Save away the current list, in case we are instantiating one
- template from within the body of another. */
- saved_local_specializations = local_specializations;
-
/* Set up the list of local specializations. */
- local_specializations = new hash_map<tree, tree>;
+ local_specialization_stack lss (push_to_top ? lss_blank : lss_copy);
+ tree block = NULL_TREE;
/* Set up context. */
if (DECL_OMP_DECLARE_REDUCTION_P (code_pattern)
= DECL_STRUCT_FUNCTION (code_pattern)->language->infinite_loop;
}
- /* We don't need the local specializations any more. */
- delete local_specializations;
- local_specializations = saved_local_specializations;
-
/* Finish the function. */
if (DECL_OMP_DECLARE_REDUCTION_P (code_pattern)
&& TREE_CODE (DECL_CONTEXT (code_pattern)) == FUNCTION_DECL)
&& (any_dependent_template_arguments_p
(INNERMOST_TEMPLATE_ARGS (DECL_TI_ARGS (expression)))))
return true;
+ }
- /* Otherwise, if the decl isn't from a dependent scope, it can't be
- type-dependent. Checking this is important for functions with auto
- return type, which looks like a dependent type. */
- if (TREE_CODE (expression) == FUNCTION_DECL
- && (!DECL_CLASS_SCOPE_P (expression)
- || !dependent_type_p (DECL_CONTEXT (expression)))
- && (!DECL_FRIEND_CONTEXT (expression)
- || !dependent_type_p (DECL_FRIEND_CONTEXT (expression)))
- && !DECL_LOCAL_FUNCTION_P (expression))
- {
- gcc_assert (!dependent_type_p (TREE_TYPE (expression))
- || undeduced_auto_decl (expression));
- return false;
- }
+ /* Otherwise, if the function decl isn't from a dependent scope, it can't be
+ type-dependent. Checking this is important for functions with auto return
+ type, which looks like a dependent type. */
+ if (TREE_CODE (expression) == FUNCTION_DECL
+ && !(DECL_CLASS_SCOPE_P (expression)
+ && dependent_type_p (DECL_CONTEXT (expression)))
+ && !(DECL_FRIEND_P (expression)
+ && (!DECL_FRIEND_CONTEXT (expression)
+ || dependent_type_p (DECL_FRIEND_CONTEXT (expression))))
+ && !DECL_LOCAL_FUNCTION_P (expression))
+ {
+ gcc_assert (!dependent_type_p (TREE_TYPE (expression))
+ || undeduced_auto_decl (expression));
+ return false;
}
/* Always dependent, on the number of arguments if nothing else. */
{
return ((VAR_P (decl) || TREE_CODE (decl) == PARM_DECL)
&& DECL_FUNCTION_SCOPE_P (decl)
+ /* Don't get confused by temporaries. */
+ && DECL_NAME (decl)
&& (DECL_CONTEXT (decl) != current_function_decl
|| parsing_nsdmi ()));
}
"positive");
t = integer_one_node;
}
+ t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
- t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
OMP_CLAUSE_OPERAND (c, 1) = t;
}
"integral constant");
remove = true;
}
+ t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
- t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
/* Update list item. */