aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/cp/typeck.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/cp/typeck.c')
-rw-r--r--gcc-4.8/gcc/cp/typeck.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc-4.8/gcc/cp/typeck.c b/gcc-4.8/gcc/cp/typeck.c
index 1a64b6890..2fa47025b 100644
--- a/gcc-4.8/gcc/cp/typeck.c
+++ b/gcc-4.8/gcc/cp/typeck.c
@@ -4103,6 +4103,11 @@ cp_build_binary_op (location_t location,
case TRUTH_ORIF_EXPR:
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
+ if (TREE_CODE (type0) == VECTOR_TYPE || TREE_CODE (type1) == VECTOR_TYPE)
+ {
+ sorry ("logical operation on vector type");
+ return error_mark_node;
+ }
result_type = boolean_type_node;
break;
@@ -5010,7 +5015,10 @@ tree
cp_truthvalue_conversion (tree expr)
{
tree type = TREE_TYPE (expr);
- if (TYPE_PTRDATAMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type)
+ /* Avoid ICE on invalid use of non-static member function. */
+ || (TREE_CODE (expr) == FUNCTION_DECL
+ && DECL_NONSTATIC_MEMBER_FUNCTION_P (expr)))
return build_binary_op (EXPR_LOCATION (expr),
NE_EXPR, expr, nullptr_node, 1);
else if (TYPE_PTR_P (type) || TYPE_PTRMEMFUNC_P (type))
@@ -5588,7 +5596,9 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
inc = cxx_sizeof_nowarn (TREE_TYPE (argtype));
}
else
- inc = integer_one_node;
+ inc = (TREE_CODE (argtype) == VECTOR_TYPE
+ ? build_one_cst (argtype)
+ : integer_one_node);
inc = cp_convert (argtype, inc, complain);
@@ -6639,7 +6649,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
where possible, and it is necessary in some cases. DR 195
addresses this issue, but as of 2004/10/26 is still in
drafting. */
- warning (0, "ISO C++ forbids casting between pointer-to-function and pointer-to-object");
+ warning (OPT_Wpedantic, "ISO C++ forbids casting between pointer-to-function and pointer-to-object");
return fold_if_not_in_template (build_nop (type, expr));
}
else if (TREE_CODE (type) == VECTOR_TYPE)
@@ -7194,8 +7204,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
side effect associated with any single compound assignment
operator. -- end note ] */
lhs = stabilize_reference (lhs);
- if (TREE_SIDE_EFFECTS (rhs))
- rhs = mark_rvalue_use (rhs);
+ rhs = rvalue (rhs);
rhs = stabilize_expr (rhs, &init);
newrhs = cp_build_binary_op (input_location,
modifycode, lhs, rhs,
@@ -7611,7 +7620,7 @@ build_ptrmemfunc (tree type, tree pfn, int force, bool c_cast_p,
/* Handle null pointer to member function conversions. */
if (null_ptr_cst_p (pfn))
{
- pfn = build_c_cast (input_location, type, pfn);
+ pfn = cp_build_c_cast (type, pfn, complain);
return build_ptrmemfunc1 (to_type,
integer_zero_node,
pfn);