This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bug report...
- To: branko dot cibej at hermes dot si (Branko Cibej)
- Subject: Re: bug report...
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Tue, 9 Jun 98 9:51:12 PDT
- Cc: jbuck at synopsys dot com, bryan at terran dot org, oliva at dcc dot unicamp dot br, egcs at cygnus dot com
> Speaking of deviations from the standard; I _think_ the C++ FDIS allows
> an expression on a return statement in a function returning void, and
> that this was allowed specifically to simplify writing templates, e.g.:
[ example deleted: basically it has
T foo() { return function_returning_T();}
and this is supposed to work with T == void ]
Yes, you're correct. The expression must have a void value (for example,
be a function returning void).
> Egcs snapshot 1998-05-31 has this to say about the code above:
>
> $ /home/brane/eval/egcs/bin/gcc -v
> Reading specs from /home/brane/eval/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.34/specs
> gcc version egcs-2.91.34 19980530 (gcc2 ss-980502 experimental)
>
> $ home/brane/eval/egcs/bin/c++ -ansi -pedantic -o void void.cc
> void.cc: In method `void functor<void>::operator ()<void>()':
> void.cc:25: instantiated from here
> void.cc:9: warning: `return' with a value, in function returning void
>
> Should this really be a pedantic warning?
It should not be a warning at all, if the value that is returned is itself
void. Yet another thing that hasn't been implemented. If anyone wants
to send a patch, this one should be easy to fix.