aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index c2b9b4af245..95186853374 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2501,7 +2501,8 @@ finish_fname (tree id)
tree decl;
decl = fname_decl (input_location, C_RID_CODE (id), id);
- if (processing_template_decl && current_function_decl)
+ if (processing_template_decl && current_function_decl
+ && decl != error_mark_node)
decl = DECL_NAME (decl);
return decl;
}
@@ -3853,7 +3854,7 @@ expand_or_defer_fn_1 (tree fn)
linkage of all functions, and as that causes writes to
the data mapped in from the PCH file, it's advantageous
to mark the functions at this point. */
- if (!DECL_IMPLICIT_INSTANTIATION (fn))
+ if (!DECL_IMPLICIT_INSTANTIATION (fn) || DECL_DEFAULTED_FN (fn))
{
/* This function must have external linkage, as
otherwise DECL_INTERFACE_KNOWN would have been
@@ -4291,7 +4292,8 @@ finish_omp_clauses (tree clauses)
error ("%qE has invalid type for %<reduction%>", t);
remove = true;
}
- else if (FLOAT_TYPE_P (TREE_TYPE (t)))
+ else if (FLOAT_TYPE_P (TREE_TYPE (t))
+ || TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE)
{
enum tree_code r_code = OMP_CLAUSE_REDUCTION_CODE (c);
switch (r_code)
@@ -4299,10 +4301,26 @@ finish_omp_clauses (tree clauses)
case PLUS_EXPR:
case MULT_EXPR:
case MINUS_EXPR:
+ break;
case MIN_EXPR:
case MAX_EXPR:
+ if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE)
+ r_code = ERROR_MARK;
break;
+ case BIT_AND_EXPR:
+ case BIT_XOR_EXPR:
+ case BIT_IOR_EXPR:
default:
+ r_code = ERROR_MARK;
+ break;
+ case TRUTH_ANDIF_EXPR:
+ case TRUTH_ORIF_EXPR:
+ if (FLOAT_TYPE_P (TREE_TYPE (t)))
+ r_code = ERROR_MARK;
+ break;
+ }
+ if (r_code == ERROR_MARK)
+ {
error ("%qE has invalid type for %<reduction(%s)%>",
t, operator_name_info[r_code].name);
remove = true;