From 2fbf1647e4dbbaa2b41bdf0b4f4ab059a7db4971 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 1 Dec 2015 09:37:43 -0500 Subject: [PATCH 11/20] FIXME: fix g++.dg/warn/pr35635.C Use EXPR_LOC_OR_LOC rather than just input_location. One dg-warning needs moving, since the caret is on the "?" of the conditional here: uchar_x = bar != 0 ~~~~~~~~ ? (unsigned char) 1024 ^~~~~~~~~~~~~~~~~~~~~~ : -1; ~~~~ --- gcc/cp/cvt.c | 4 ++-- gcc/testsuite/g++.dg/warn/pr35635.C | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index ebca004..f24f280 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -650,8 +650,8 @@ cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain) folded_result = fold_simple (folded_result); if (!TREE_OVERFLOW_P (folded) && folded_result != error_mark_node) - warnings_for_convert_and_check (input_location, type, folded, - folded_result); + warnings_for_convert_and_check (EXPR_LOC_OR_LOC (expr, input_location), + type, folded, folded_result); } return result; diff --git a/gcc/testsuite/g++.dg/warn/pr35635.C b/gcc/testsuite/g++.dg/warn/pr35635.C index de68ceb..19345c5 100644 --- a/gcc/testsuite/g++.dg/warn/pr35635.C +++ b/gcc/testsuite/g++.dg/warn/pr35635.C @@ -62,9 +62,9 @@ void func3() /* At least one branch of ? does not fit in the destination, thus warn. */ uchar_x = bar != 0 ? 2.1 : 10; /* { dg-warning "conversion" } */ - uchar_x = bar != 0 /* { dg-warning "negative integer implicitly converted to unsigned type" } */ - ? (unsigned char) 1024 - : -1; + uchar_x = bar != 0 + ? (unsigned char) 1024 /* { dg-warning "negative integer implicitly converted to unsigned type" } */ + : -1; } void func4() -- 1.8.5.3