public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppluzhnikov at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/52676] New: bogus warning: control reaches end of non-void function
Date: Thu, 22 Mar 2012 20:25:00 -0000	[thread overview]
Message-ID: <bug-52676-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2012-03-22 20:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22 20:25 ppluzhnikov at google dot com [this message]
2014-01-24  4:27 ` [Bug c++/52676] " pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52676-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).