re PR c++/45385 (missing -Wconversion for method calls)
/cp 2011-10-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/45385 * init.c (build_vec_init): Early return error_mark_node if maxindex is -1. /c-family 2011-10-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/45385 * c-common.c (conversion_warning): Remove code looking for artificial operands. /testsuite 2011-10-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/45385 * g++.dg/warn/Wconversion4.C: New. From-SVN: r180312
This commit is contained in:
parent
9956ad4d14
commit
d2e312d7e5
6 changed files with 36 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-10-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/45385
|
||||
* c-common.c (conversion_warning): Remove code looking for
|
||||
artificial operands.
|
||||
|
||||
2011-10-18 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR bootstrap/50760
|
||||
|
|
|
@ -2121,23 +2121,12 @@ unsafe_conversion_p (tree type, tree expr, bool produce_warns)
|
|||
static void
|
||||
conversion_warning (tree type, tree expr)
|
||||
{
|
||||
int i;
|
||||
const int expr_num_operands = TREE_OPERAND_LENGTH (expr);
|
||||
tree expr_type = TREE_TYPE (expr);
|
||||
location_t loc = EXPR_LOC_OR_HERE (expr);
|
||||
|
||||
if (!warn_conversion && !warn_sign_conversion)
|
||||
return;
|
||||
|
||||
/* If any operand is artificial, then this expression was generated
|
||||
by the compiler and we do not warn. */
|
||||
for (i = 0; i < expr_num_operands; i++)
|
||||
{
|
||||
tree op = TREE_OPERAND (expr, i);
|
||||
if (op && DECL_P (op) && DECL_ARTIFICIAL (op))
|
||||
return;
|
||||
}
|
||||
|
||||
switch (TREE_CODE (expr))
|
||||
{
|
||||
case EQ_EXPR:
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2011-10-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/45385
|
||||
* init.c (build_vec_init): Early return error_mark_node if
|
||||
maxindex is -1.
|
||||
|
||||
2011-10-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/31423
|
||||
|
|
|
@ -2998,7 +2998,8 @@ build_vec_init (tree base, tree maxindex, tree init,
|
|||
if (TREE_CODE (atype) == ARRAY_TYPE && TYPE_DOMAIN (atype))
|
||||
maxindex = array_type_nelts (atype);
|
||||
|
||||
if (maxindex == NULL_TREE || maxindex == error_mark_node)
|
||||
if (maxindex == NULL_TREE || maxindex == error_mark_node
|
||||
|| integer_all_onesp (maxindex))
|
||||
return error_mark_node;
|
||||
|
||||
if (explicit_value_init_p)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2011-10-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/45385
|
||||
* g++.dg/warn/Wconversion4.C: New.
|
||||
|
||||
2011-10-21 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/50813
|
||||
|
|
17
gcc/testsuite/g++.dg/warn/Wconversion4.C
Normal file
17
gcc/testsuite/g++.dg/warn/Wconversion4.C
Normal file
|
@ -0,0 +1,17 @@
|
|||
// PR c++/45385
|
||||
// { dg-options "-Wconversion" }
|
||||
|
||||
void foo(unsigned char);
|
||||
|
||||
class Test
|
||||
{
|
||||
void eval()
|
||||
{
|
||||
foo(bar()); // { dg-warning "may alter its value" }
|
||||
}
|
||||
|
||||
unsigned int bar() const
|
||||
{
|
||||
return __INT_MAX__ * 2U + 1;
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue