This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52676] New: bogus warning: control reaches end of non-void function


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]