aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/error.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-11-08 15:17:42 -0500
committerJason Merrill <jason@gcc.gnu.org>2010-11-08 15:17:42 -0500
commit9e115cec97350099177071bb16b3efcbbacc9445 (patch)
tree29e021e2fec06d40962f55e47d182c721d950eae /gcc/cp/error.c
parent1b2c3293fbe12f7fa3254af12e9d0ca98d89c5aa (diff)
downloadgcc-9e115cec97350099177071bb16b3efcbbacc9445.zip
gcc-9e115cec97350099177071bb16b3efcbbacc9445.tar.gz
gcc-9e115cec97350099177071bb16b3efcbbacc9445.tar.bz2
Correct conversion/overflow behavior.
* cvt.c (ignore_overflows): Move here from typeck.c. (ocp_convert): Use it. (cp_fold_convert): Use it. Don't call rvalue. * typeck.c (build_static_cast_1): Don't use it. Do call rvalue. * error.c (location_of): Handle expressions, too. * class.c (check_bitfield_decl): Set input_location around call to cxx_constant_value. * semantics.c (cxx_eval_outermost_constant_expr): Don't print the expression if it already had TREE_OVERFLOW set. (reduced_constant_expression_p): Check TREE_OVERFLOW_P for C++98, too. (verify_constant): Allow overflow with a permerror if we're enforcing. (cxx_eval_outermost_constant_expr): Use verify_constant. (adjust_temp_type): Use cp_fold_convert. * decl.c (build_enumerator): Don't call constant_expression_warning. * decl2.c (grokbitfield): Likewise. From-SVN: r166453
Diffstat (limited to 'gcc/cp/error.c')
-rw-r--r--gcc/cp/error.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 6f60c06..1560fc6 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2469,7 +2469,9 @@ location_of (tree t)
else if (TREE_CODE (t) == OVERLOAD)
t = OVL_FUNCTION (t);
- return DECL_SOURCE_LOCATION (t);
+ if (DECL_P (t))
+ return DECL_SOURCE_LOCATION (t);
+ return EXPR_LOC_OR_HERE (t);
}
/* Now the interfaces from error et al to dump_type et al. Each takes an