This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: rreturning void
- To: dcb at pncl dot co dot uk (David C Binderman), egcs-bugs at cygnus dot com
- Subject: Re: rreturning void
- From: Jason Merrill <jason at cygnus dot com>
- Date: 17 Jun 1998 18:43:45 -0700
- References: <199806172020.VAA21952.cygnus.egcs.bugs@eiger.pncl.co.uk>
>>>>> David C Binderman <dcb@pncl.co.uk> writes:
> Hello there,
> The following code used to not compile, but on egcs-980615 it does.
> void
> function() {
> int var = 0;
> return (void) ++var;
> }
> I think that this code should not be compilable, and would like to find
> out which bit of the ISO spec says this is ok.
This was added recently, for templates:
6.6.3 - The return statement [stmt.return]
3- 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.
Jason