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;

}

Reply via email to