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]

Re: rreturning void


>>>>> 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


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