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: unassig...@gcc.gnu.org ReportedBy: ppluzhni...@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; }