[Bug middle-end/68336] False positive Wreturn-type warning
s-beyer at gmx dot net
gcc-bugzilla@gcc.gnu.org
Tue Jan 10 21:11:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68336
Stephan Beyer <s-beyer at gmx dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |s-beyer at gmx dot net
--- Comment #3 from Stephan Beyer <s-beyer at gmx dot net> ---
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
More information about the Gcc-bugs
mailing list