summaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 6d0e34156ff..1ba07876683 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -79,7 +79,7 @@ cp_convert_to_pointer (tree type, tree expr, tsubst_flags_t complain)
tree intype = TREE_TYPE (expr);
enum tree_code form;
tree rval;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (intype == error_mark_node)
return error_mark_node;
@@ -414,7 +414,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
tree rval = NULL_TREE;
tree rval_as_conversion = NULL_TREE;
bool can_convert_intype_to_type;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (TREE_CODE (type) == FUNCTION_TYPE
&& TREE_TYPE (expr) == unknown_type_node)
@@ -629,7 +629,8 @@ cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain)
{
tree folded = maybe_constant_value (expr);
tree stripped = folded;
- tree folded_result = cp_convert (type, folded, complain);
+ tree folded_result
+ = folded != expr ? cp_convert (type, folded, complain) : result;
/* maybe_constant_value wraps an INTEGER_CST with TREE_OVERFLOW in a
NOP_EXPR so that it isn't TREE_CONSTANT anymore. */
@@ -655,7 +656,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
enum tree_code code = TREE_CODE (type);
const char *invalid_conv_diag;
tree e1;
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (error_operand_p (e) || type == error_mark_node)
return error_mark_node;
@@ -911,7 +912,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
tree
convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
{
- location_t loc = EXPR_LOC_OR_HERE (expr);
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
if (expr == error_mark_node
|| TREE_TYPE (expr) == error_mark_node)