[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-11 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 Eric Gallager changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-11 Thread vlovich at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #17 from Vitali --- I was explicitly asked to open this as a separate bug in comment #7 of 87950. Would be helpful if the GCC devs could coordinate to figure out if they want separate bugs for C/C++ or 1 bug. Jonathan, on this forum

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-11 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #16 from Jonathan Wakely --- (In reply to Martin Sebor from comment #14) > This is a duplicate of bug 87950, with most of the same discussion. > > *** This bug has been marked as a duplicate of bug 87950 *** I think I need to add an

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-10 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org S

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-10 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 Martin Sebor changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC|

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-10 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #13

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #12 from Jonathan Wakely --- It's not a useless warning. If I call your function from comment 7 like this, I get undefined behaviour: CoverMyBases( Enum{2} ); Your switch is undefined for this code. That's what GCC is warning you

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-10 Thread safinaskar at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #11 from Askar Safin --- (In reply to Jonathan Wakely from comment #10) > I wish people would just learn how enums work, it's not that complicated. Okey, now I understand everything. Now I see that, well, -fstrict-enums silences warn

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #10 from Jonathan Wakely --- No. They're not "less strict", but they have a fixed underlying type. For any enumeration type with a fixed underlying type (whether "enum class" or just "enum") the validvalues of the type are all the va

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-08 Thread safinaskar at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #9 from Askar Safin --- (In reply to Andrew Pinski from comment #8) > Yes because they have different semantics ... So, you mean that "enum class" is less strict than normal enums? This is very strange. Today I normally use "enum cl

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-08 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #8 from Andrew Pinski --- (In reply to Askar Safin from comment #7) > "g++ -fstrict-enums" doesn't disable warning if I use "enum class" instead > of plain enum. Yes because they have different semantics ...

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-12-08 Thread safinaskar at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 Askar Safin changed: What|Removed |Added CC||safinaskar at mail dot ru --- Comment #7 f

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-11-09 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #6 from Jonathan Wakely --- (In reply to Vitali from comment #5) > Jonathan, I think the defect report here does actually apply to this > example. I didn't say otherwise. > I agree the argument could be made that if there's gaps in

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-11-09 Thread vlovich at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #5 from Vitali --- Jonathan, I think the defect report here does actually apply to this example. I agree the argument could be made that if there's gaps in the enum values that it's arguable that the current GCC behaviour is standards

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-11-09 Thread vlovich at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #4 from Vitali --- Is there a way to annotate a specific enum as strict?

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-11-09 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #3 from Jonathan Wakely --- (In reply to Vitali from comment #0) > If a function has a single switch statement that handles all enum values & > returns a value GCC will warn about the function not returning a value > whereas clang doe

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-11-09 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 --- Comment #2 from Martin Liška --- One more comment here. I do cooperate with our openSUSE maintainer of Chromium package and they have quite some of these warnings when building with GCC. I told him he can strengthen behavior with -fstrict-enu

[Bug c++/87951] GCC warns about reaching end of non-void function when all switch is completely handled

2018-11-09 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951 Martin Liška changed: What|Removed |Added Last reconfirmed||2018-11-9 CC|