[Bug middle-end/68336] False positive Wreturn-type warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68336 Eric Gallager changed: What|Removed |Added Status|NEW |RESOLVED CC||egallager at gcc dot gnu.org Resolution|--- |DUPLICATE --- Comment #4 from Eric Gallager --- Comment in bug 67629 said this one might be a duplicate of that one, so closing it as such. *** This bug has been marked as a duplicate of bug 67629 ***
[Bug middle-end/68336] False positive Wreturn-type warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68336 Stephan Beyer changed: What|Removed |Added CC||s-beyer at gmx dot net --- Comment #3 from Stephan Beyer --- Hi, these false-positives still occur in g++ 6.3.0 I am mentioning this because I want to add another test case: $ cat foo.cc enum class Test { first, second }; int return_warning(Test foo) { switch (foo) { case Test::first: return 23; case Test::second: return 42; } } $ g++-6 -std=c++11 -Wreturn-type -c foo.cc foo.cc: In function ‘int return_warning(Test)’: foo.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ $ g++-6 --version g++-6 (Debian 6.3.0-2) 6.3.0 20161229 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This is directly related to #60725. Note the difference that an "enum class" is used here instead of an unscoped "enum". I however do not think that this actually makes a difference in C++. ("enum Test foo = 3" is valid in C but not in C++, right?) Regards Stephan
[Bug middle-end/68336] False positive Wreturn-type warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68336 --- Comment #1 from Yichao Yu --- Ref clang bug report https://llvm.org/bugs/show_bug.cgi?id=25521
[Bug middle-end/68336] False positive Wreturn-type warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68336 Martin Sebor changed: What|Removed |Added Keywords||diagnostic Status|UNCONFIRMED |NEW Last reconfirmed||2015-11-13 CC||msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Martin Sebor --- Confirmed. An even simpler test case is below. See also bug 67629. $ cat z.c && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S -Wall -o/dev/null z.c int f (void) { for (int i = 1; i; ) return 1; } z.c: In function ‘f’: z.c:5:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ G++ also warns on the trivial: int f (void) { if (bool b = true) return 1; }