mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/50011 ([C++0x] warning: narrowing conversion of 'i' from 'short unsigned int' to 'int' inside { } [-Wnarrowing])
PR c++/50011 * typeck2.c (check_narrowing): Fix integer logic. From-SVN: r177565
This commit is contained in:
parent
cca2207a2d
commit
d7cfa3145f
|
@ -1,3 +1,8 @@
|
||||||
|
2011-08-08 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/50011
|
||||||
|
* typeck2.c (check_narrowing): Fix integer logic.
|
||||||
|
|
||||||
2011-08-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
2011-08-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
* Make-lang.in (g++$(exeext)): Add $(EXTRA_GCC_LIBS).
|
* Make-lang.in (g++$(exeext)): Add $(EXTRA_GCC_LIBS).
|
||||||
|
|
|
@ -740,8 +740,10 @@ check_narrowing (tree type, tree init)
|
||||||
else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype)
|
else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype)
|
||||||
&& CP_INTEGRAL_TYPE_P (type))
|
&& CP_INTEGRAL_TYPE_P (type))
|
||||||
{
|
{
|
||||||
if ((TYPE_PRECISION (type) < TYPE_PRECISION (ftype)
|
if ((tree_int_cst_lt (TYPE_MAX_VALUE (type),
|
||||||
|| TYPE_UNSIGNED (type) != TYPE_UNSIGNED (ftype))
|
TYPE_MAX_VALUE (ftype))
|
||||||
|
|| tree_int_cst_lt (TYPE_MIN_VALUE (ftype),
|
||||||
|
TYPE_MIN_VALUE (type)))
|
||||||
&& (TREE_CODE (init) != INTEGER_CST
|
&& (TREE_CODE (init) != INTEGER_CST
|
||||||
|| !int_fits_type_p (init, type)))
|
|| !int_fits_type_p (init, type)))
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2011-08-08 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
* g++.dg/cpp0x/initlist5.C: Add 50011 test.
|
||||||
|
|
||||||
2011-08-07 Janus Weil <janus@gcc.gnu.org>
|
2011-08-07 Janus Weil <janus@gcc.gnu.org>
|
||||||
|
|
||||||
PR fortran/49638
|
PR fortran/49638
|
||||||
|
|
|
@ -29,3 +29,7 @@ float fa2[] = { d2, 1.1 };
|
||||||
// PR c++/49577
|
// PR c++/49577
|
||||||
unsigned u{ -1 }; // { dg-error "narrowing" }
|
unsigned u{ -1 }; // { dg-error "narrowing" }
|
||||||
char c = char{ u }; // { dg-error "narrowing" }
|
char c = char{ u }; // { dg-error "narrowing" }
|
||||||
|
|
||||||
|
// PR c++/50011
|
||||||
|
short unsigned su;
|
||||||
|
int i { su };
|
||||||
|
|
Loading…
Reference in New Issue