Commit 3c1247f0 by Paolo Carlini Committed by Paolo Carlini

re PR c++/23608 (constant propagation (CCP) would improve -Wsign-compare)

/cp
2013-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/23608
	* call.c (build_new_op_1): Propagate loc to cp_build_binary_op.

/testsuite
2013-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/23608
	* g++.dg/warn/Wsign-compare-6.C: New.
	* g++.dg/warn/Wdouble-promotion.C: Adjust.

From-SVN: r199102
parent 8f1352c4
2013-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/23608
* call.c (build_new_op_1): Propagate loc to cp_build_binary_op.
2013-05-20 Jason Merrill <jason@redhat.com>
PR c++/57317
......
......@@ -5418,7 +5418,7 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
case BIT_AND_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
return cp_build_binary_op (input_location, code, arg1, arg2, complain);
return cp_build_binary_op (loc, code, arg1, arg2, complain);
case UNARY_PLUS_EXPR:
case NEGATE_EXPR:
......
2013-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/23608
* g++.dg/warn/Wsign-compare-6.C: New.
* g++.dg/warn/Wdouble-promotion.C: Adjust.
2013-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57327
* g++.dg/template/error50.C: New.
......
......@@ -5,7 +5,7 @@
/* Some targets do not provide <complex.h> so we define I ourselves. */
#define I 1.0iF
#define ID ((_Complex double)I) // { dg-warning "implicit" }
#define ID ((_Complex double)I)
float f;
double d;
......@@ -36,7 +36,7 @@ usual_arithmetic_conversions(void)
local_cf = cf + 1.0; /* { dg-warning "implicit" } */
local_cf = cf - d; /* { dg-warning "implicit" } */
local_cf = cf + 1.0 * ID; /* { dg-message "in expansion of macro 'ID'" } */
local_cf = cf + 1.0 * ID; /* { dg-warning "implicit" } */
local_cf = cf - cd; /* { dg-warning "implicit" } */
local_f = i ? f : d; /* { dg-warning "implicit" } */
......
// PR c++/23608
// { dg-options "-Wsign-compare" }
#define FIVE 5
int main()
{
int i = 5;
int const ic = 5;
i < 5u; // { dg-warning "5:comparison between signed and unsigned" }
ic < 5u;
FIVE < 5u;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment