[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Target Milestone|--- |4.7.2 --- Comment #14 from Jason Merrill 2012-09-17 16:42:44 UTC --- Fixed for 4.7.2.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Target Milestone|--- |4.7.2 --- Comment #13 from Jason Merrill 2012-09-17 16:41:49 UTC --- Author: jason Date: Mon Sep 17 16:41:41 2012 New Revision: 191398 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191398 Log: PR c++/53661 * typeck2.c (check_narrowing): Avoid false positives on conversion from enumeral type. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/init/aggr9.C Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/typeck2.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog --- Comment #14 from Jason Merrill 2012-09-17 16:42:44 UTC --- Fixed for 4.7.2.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 --- Comment #13 from Jason Merrill 2012-09-17 16:41:49 UTC --- Author: jason Date: Mon Sep 17 16:41:41 2012 New Revision: 191398 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191398 Log: PR c++/53661 * typeck2.c (check_narrowing): Avoid false positives on conversion from enumeral type. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/init/aggr9.C Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/typeck2.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 --- Comment #12 from Harald van Dijk 2012-09-17 16:25:09 UTC --- Oops, quite right, sorry about that.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 --- Comment #11 from Jason Merrill 2012-09-17 16:06:10 UTC --- Author: jason Date: Mon Sep 17 16:06:03 2012 New Revision: 191395 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191395 Log: PR c++/53661 * typeck2.c (check_narrowing): Avoid false positives on conversion from enumeral type. Added: trunk/gcc/testsuite/g++.dg/init/aggr9.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck2.c trunk/gcc/testsuite/ChangeLog
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 --- Comment #10 from Jason Merrill 2012-09-17 15:42:41 UTC --- (In reply to comment #9) > 7.2p7 starts as "For an enumeration whose underlying type is > fixed,", so does not apply. That's just the first sentence; the rest of p7 does apply.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 Harald van Dijk changed: What|Removed |Added CC||harald at gigawatt dot nl --- Comment #9 from Harald van Dijk 2012-09-14 16:28:40 UTC --- Sorry for butting in, but is this really a bug? 7.2p5 says "Each enumeration defines a type that is different from all other types. Each enumeration also has an underlying type. The underlying type can be explicitly specified using enum-base; if not explicitly specified, the underlying type of a scoped enumeration type is int. In these cases, the underlying type is said to be fixed." This is an unscoped enumeration type without an enum-base, so the underlying type is not fixed. 7.2p7 starts as "For an enumeration whose underlying type is fixed,", so does not apply. 7.2p6 does apply, but the relevant text of 7.2p7 that would make this code valid isn't present there.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 --- Comment #8 from Manuel López-Ibáñez 2012-09-14 14:07:21 UTC --- Wconversion does not warn either, but it also does not warn for: enum Code { SUCCESS=-1 }; Code a; void foo(void) { unsigned int r; r = a; } Perhaps the code for handling this could be shared between Wconversion and Wnarrowing (they warn in different cases but finding out these cases probably requires similar code).
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 Paolo Carlini changed: What|Removed |Added CC|jason at gcc dot gnu.org| --- Comment #7 from Paolo Carlini 2012-09-14 13:49:00 UTC --- Ah, ah, I see, thanks.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 Jason Merrill changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2012-09-14 AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #6 from Jason Merrill 2012-09-14 13:46:12 UTC --- This is a bug. The values of Code (as per 7.2p7) are { 0, 1 }, and int can represent both values, so the conversion is not a narrowing conversion.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 Paolo Carlini changed: What|Removed |Added CC||jason at gcc dot gnu.org --- Comment #5 from Paolo Carlini 2012-09-14 09:37:00 UTC --- Indeed, I think it is, unless something says that the underlying type must be int, but I don't think how. I think this PR is invalid. Let's ask Jason, to be safe.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 --- Comment #4 from Manuel López-Ibáñez 2012-09-14 06:05:09 UTC --- (In reply to comment #2) > Manuel, what do you think about this? I see the warning happening because the > underlying type of Code is unsigned int. Isn't this a warning mandated by the standard?
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 Paolo Carlini changed: What|Removed |Added CC||manu at gcc dot gnu.org --- Comment #3 from Paolo Carlini 2012-09-13 23:43:01 UTC --- Actually adding Manuel in CC.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 --- Comment #2 from Paolo Carlini 2012-09-13 23:40:22 UTC --- Manuel, what do you think about this? I see the warning happening because the underlying type of Code is unsigned int.
[Bug c++/53661] [gcc-4.7/4.8 regression] Wrong narrowing conversion warning with -std=c++11
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53661 Sriraman Tallam changed: What|Removed |Added Component|c |c++ Summary|Wrong narrowing conversion |[gcc-4.7/4.8 regression] |warning with -std=c++11 |Wrong narrowing conversion ||warning with -std=c++11 --- Comment #1 from Sriraman Tallam 2012-08-07 22:33:58 UTC --- Tip of trunk still fails.