This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25986] return from funcrtion of void value allowed
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jan 2006 01:01:50 -0000
- Subject: [Bug c++/25986] return from funcrtion of void value allowed
- References: <bug-25986-6649@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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