C++ PATCH: PR6438
Jakub Jelinek
jakub@redhat.com
Thu Apr 25 05:21:00 GMT 2002
On Wed, Apr 24, 2002 at 03:43:43PM -0700, Mark Mitchell wrote:
>
> The evil statement-expression extension strikes again.
>
> Normally, we convert expression-statements to "void". In other
> words, we turn:
>
> a = c + 3;
>
> into:
>
> (void)(a = c + 3);
>
> in the C++ front end. This is somewhat pointless, but we do it to
> get certain warnings and such at that point.
>
> However, if we're in a statement-expression it's bad to do this; the
> value might be needed. Fortunately, we have a flag that indicates
> that the conversion is being done implicitly, in which case we don't
> really do the conversion; we just pretend.
>
> Except that when the expression was a ?:-expression, we did do the
> conversion even when we weren't supposed to do so.
>
> Fixed thusly, tested on i686-pc-linux-gnu, applied on the branch
> and the mainline.
This looks very much like PR c++/5373, with an (uncommited) fix
http://gcc.gnu.org/ml/gcc-patches/2002-01/msg01249.html
which is slightly different from what you've done.
> 2002-04-24 Mark Mitchell <mark@codesourcery.com>
>
> * cvt.c (convert_to_void): Don't unconditionally make COND_EXPRs
> void.
Jakub
More information about the Gcc-patches
mailing list