summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-30 16:15:36 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-30 16:15:36 +0000
commit22a75734063ff48f630a60a57258442e4327525f (patch)
tree1864e86fe52740bb3329849e59bfb3edd8b05587 /gcc/cp
parent8a6bcd4ee7a6e7f7bfc4932dd530a272902dc7f8 (diff)
downloadgcc-22a75734063ff48f630a60a57258442e4327525f.tar.gz
PR c/59940
c-family/ * c-common.h (unsafe_conversion_p): Adjust declaration. (warnings_for_convert_and_check): Likewise. (convert_and_check): Likewise. * c-common.c (unsafe_conversion_p): Add location parameter. Call expansion_point_location_if_in_system_header on it. (warnings_for_convert_and_check): Add location parameter. Call expansion_point_location_if_in_system_header on it. Use it. (convert_and_check): Add location parameter. Use it. (conversion_warning): Likewise. (c_add_case_label): Adjust convert_and_check calls. (scalar_to_vector): Adjust unsafe_conversion_p calls. cp/ * typeck.c (build_ptrmemfunc1): Call convert_and_check with input_location. * cvt.c (cp_convert_and_check): Call warnings_for_convert_and_check with input_location. * call.c (build_conditional_expr_1): Call unsafe_conversion_p with loc parameter. c/ * c-typeck.c (build_function_call_vec): Use loc parameter. (convert_arguments): Add location parameter. Use it. (ep_convert_and_check): Likewise. (build_atomic_assign): Adjust convert_for_assignment call. (build_modify_expr): Likewise. (digest_init): Likewise. (c_finish_return): Likewise. (build_conditional_expr): Adjust ep_convert_and_check calls. (convert_for_assignment): Add rhs_loc parameter. Use it. (build_binary_op): Adjust convert_and_check and ep_convert_and_check calls. testsuite/ * gcc.dg/pr59940.c: New test. * gcc.dg/pr35635.c (func3): Move dg-warning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207309 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/call.c4
-rw-r--r--gcc/cp/cvt.c3
-rw-r--r--gcc/cp/typeck.c2
4 files changed, 15 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f49e2e55c4b..392fd1d7663 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2014-01-30 Marek Polacek <polacek@redhat.com>
+
+ PR c/59940
+ * typeck.c (build_ptrmemfunc1): Call convert_and_check with
+ input_location.
+ * cvt.c (cp_convert_and_check): Call warnings_for_convert_and_check
+ with input_location.
+ * call.c (build_conditional_expr_1): Call unsafe_conversion_p with
+ loc parameter.
+
2014-01-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58843
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index f572bc1fc88..71f95dbed4a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4484,14 +4484,14 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
but the warnings (like Wsign-conversion) have already been
given by the scalar build_conditional_expr_1. We still check
unsafe_conversion_p to forbid truncating long long -> float. */
- if (unsafe_conversion_p (stype, arg2, false))
+ if (unsafe_conversion_p (loc, stype, arg2, false))
{
if (complain & tf_error)
error_at (loc, "conversion of scalar %qT to vector %qT "
"involves truncation", arg2_type, vtype);
return error_mark_node;
}
- if (unsafe_conversion_p (stype, arg3, false))
+ if (unsafe_conversion_p (loc, stype, arg3, false))
{
if (complain & tf_error)
error_at (loc, "conversion of scalar %qT to vector %qT "
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index c2cdf833802..e8ece0e0b13 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -639,7 +639,8 @@ cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain)
if (!TREE_OVERFLOW_P (stripped)
&& folded_result != error_mark_node)
- warnings_for_convert_and_check (type, folded, folded_result);
+ warnings_for_convert_and_check (input_location, type, folded,
+ folded_result);
}
return result;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b6f47384f31..924937832f5 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -7715,7 +7715,7 @@ build_ptrmemfunc1 (tree type, tree delta, tree pfn)
delta_field = DECL_CHAIN (pfn_field);
/* Make sure DELTA has the type we want. */
- delta = convert_and_check (delta_type_node, delta);
+ delta = convert_and_check (input_location, delta_type_node, delta);
/* Convert to the correct target type if necessary. */
pfn = fold_convert (TREE_TYPE (pfn_field), pfn);