aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/cp/semantics.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/cp/semantics.c')
-rw-r--r--gcc-4.8/gcc/cp/semantics.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/gcc-4.8/gcc/cp/semantics.c b/gcc-4.8/gcc/cp/semantics.c
index 580c609ac..0debc78e8 100644
--- a/gcc-4.8/gcc/cp/semantics.c
+++ b/gcc-4.8/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;
@@ -5059,7 +5077,7 @@ finish_omp_atomic (enum tree_code code, enum tree_code opcode, tree lhs,
}
stmt = build2 (OMP_ATOMIC, void_type_node, integer_zero_node, stmt);
}
- add_stmt (stmt);
+ finish_expr_stmt (stmt);
}
void
@@ -7543,7 +7561,7 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT;
tree index = bitsize_int (indexi);
- if (offset/part_widthi <= TYPE_VECTOR_SUBPARTS (op00type))
+ if (offset / part_widthi < TYPE_VECTOR_SUBPARTS (op00type))
return fold_build3_loc (loc,
BIT_FIELD_REF, type, op00,
part_width, index);
@@ -9481,7 +9499,14 @@ lambda_expr_this_capture (tree lambda)
/* In unevaluated context this isn't an odr-use, so just return the
nearest 'this'. */
if (cp_unevaluated_operand)
+ {
+ /* In an NSDMI the fake 'this' pointer that we're using for
+ parsing is in scope_chain. */
+ if (LAMBDA_EXPR_EXTRA_SCOPE (lambda)
+ && TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (lambda)) == FIELD_DECL)
+ return scope_chain->x_current_class_ptr;
return lookup_name (this_identifier);
+ }
/* Try to default capture 'this' if we can. */
if (!this_capture