mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/53661 (Wrong narrowing conversion warning with -std=c++11)
PR c++/53661 * typeck2.c (check_narrowing): Avoid false positives on conversion from enumeral type. From-SVN: r191395
This commit is contained in:
parent
f57f20bb75
commit
5e23183b93
|
|
@ -1,3 +1,9 @@
|
||||||
|
2012-09-14 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/53661
|
||||||
|
* typeck2.c (check_narrowing): Avoid false positives on conversion
|
||||||
|
from enumeral type.
|
||||||
|
|
||||||
2012-09-14 Marc Glisse <marc.glisse@inria.fr>
|
2012-09-14 Marc Glisse <marc.glisse@inria.fr>
|
||||||
|
|
||||||
PR c++/54427
|
PR c++/54427
|
||||||
|
|
|
||||||
|
|
@ -787,6 +787,9 @@ 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 (TREE_CODE (ftype) == ENUMERAL_TYPE)
|
||||||
|
/* Check for narrowing based on the values of the enumeration. */
|
||||||
|
ftype = ENUM_UNDERLYING_TYPE (ftype);
|
||||||
if ((tree_int_cst_lt (TYPE_MAX_VALUE (type),
|
if ((tree_int_cst_lt (TYPE_MAX_VALUE (type),
|
||||||
TYPE_MAX_VALUE (ftype))
|
TYPE_MAX_VALUE (ftype))
|
||||||
|| tree_int_cst_lt (TYPE_MIN_VALUE (ftype),
|
|| tree_int_cst_lt (TYPE_MIN_VALUE (ftype),
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2012-09-14 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/53661
|
||||||
|
* g++.dg/init/aggr9.C: New.
|
||||||
|
|
||||||
2012-09-17 Eric Botcazou <ebotcazou@adacore.com>
|
2012-09-17 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
* gnat.dg/loop_optimization12.ad[sb]: New test.
|
* gnat.dg/loop_optimization12.ad[sb]: New test.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// PR c++/53661
|
||||||
|
|
||||||
|
enum Code {
|
||||||
|
SUCCESS = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
Code a;
|
||||||
|
|
||||||
|
int r[] = {a};
|
||||||
Loading…
Reference in New Issue