public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/55189] enable -Wreturn-type by default
Date: Sat, 03 Nov 2012 13:03:00 -0000	[thread overview]
Message-ID: <bug-55189-4-qB1wziO2K7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55189-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55189

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-03
            Summary|g++ compiler does not       |enable -Wreturn-type by
                   |report missing return on    |default
                   |function with return type   |
     Ever Confirmed|0                           |1

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-03 13:03:14 UTC ---
(In reply to comment #2)
> If this is not bug why shouldn't we make
> 
> int n;
> n =;
> printf("%d",n);
> 
> to be legal code, compiler should simply assign whatever it wants. Right ?

No, because that's not even legal syntax, so that's a completely different
case.


> -Wreturn-type should be set by default.

OK, so let's change the report to say that then.

In general though, please don't report bugs claiming there are no warnings if
you haven't even tried -Wall, there's a notice when you report a bug asking you
to check that.

Reduced example:

struct A { int i; };

A f()
{
  A a = { 0 };
  // missing return
}

int main()
{
  A a = f();
  return a.i;
}


  parent reply	other threads:[~2012-11-03 13:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-03 10:30 [Bug c++/55189] New: g++ compiler does not report missing return on function with return type meanarbez at gmail dot com
2012-11-03 10:40 ` [Bug c++/55189] " glisse at gcc dot gnu.org
2012-11-03 11:11 ` meanarbez at gmail dot com
2012-11-03 13:03 ` redi at gcc dot gnu.org [this message]
2012-11-04 14:09 ` [Bug c++/55189] enable -Wreturn-type by default paolo.carlini at oracle dot com
2012-11-04 15:26 ` paolo.carlini at oracle dot com
2013-12-27 14:10 ` sylvestre at debian dot org
2014-04-17 12:05 ` sylvestre at debian dot org
2014-04-17 13:13 ` manu 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-55189-4-qB1wziO2K7@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).