[PATCH] Fix PR gdb/290
Joe Buck
jbuck@synopsys.COM
Sat Feb 9 11:51:00 GMT 2002
Andrew writes:
> static void f3 (void) { return; }
> ...
> so ok so far. Hmm, I think this tells the story:
>
> static void f5 (int a) { return f3(); }
>
> Returning the result from a function that returns void (f3()) doesn't
> attract a warning.
> Bug or feature?
For C++, it is a non-optional feature; the standard requires this to work
correctly (a void function may say "return foop();" if foop's return type
is void). The reason for this will become clear after you write templates
for a while; without it "void" becomes more of an oddball case.
For C89, I don't think it's legal though it may be reasonable to accept
as an extension; I don't know about C99.
More information about the Gcc
mailing list