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++/25986] return from funcrtion of void value allowed



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-01-27 01:01 -------
(In reply to comment #4)
> No need to further change language.

Change what language? C++?
Well it is part of the C++ standard.
6.6.3/2:
A return statement with an expression of type "cv void" can be used only in
functions with a return type of cv void; the expression is evaluated just
before the function returns to its caller.


Which means:

int f(void);

void g(void)
{
  return (void)f();
}

is also valid.

So the warning is useless as this is explicated in the C++ standard.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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