This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52676] New: bogus warning: control reaches end of non-void function
- From: "ppluzhnikov at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 Mar 2012 20:23:15 +0000
- Subject: [Bug c++/52676] New: bogus warning: control reaches end of non-void function
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52676
Bug #: 52676
Summary: bogus warning: control reaches end of non-void
function
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ppluzhnikov@google.com
Using current SVN trunk "g++ (GCC) 4.8.0 20120322 (experimental)"
g++ -c -Wreturn-type t.cc
t.cc: In function âint fn1()â:
t.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
Same result from "g++ (GCC) 4.7.0 20120124 (experimental)"
Using released GCC 4.6.3 for the same source produces no warning.
struct string {
~string();
};
struct ostream {
ostream & operator<<(bool);
};
struct LogMessage {
ostream & stream();
};
struct LogMessageFatal: public LogMessage {
LogMessageFatal();
~LogMessageFatal()
__attribute__( (noreturn) ); // comment out: both 4.6.3 and trunk
// issue warning
};
int fn1()
{
string s; // comment out: trunk no longer issues a warning
if (0)
LogMessageFatal().stream() << false;
else
return 0;
}