tcc_statement vs. tcc_expression in the C++ frontend
Nathan Sidwell
nathan@codesourcery.com
Sat Apr 23 16:48:00 GMT 2005
Ian Lance Taylor wrote:
> The description of tcc_statement in tree.h says "A statement
> expression, which have side effects but usually no interesting value."
>
> There are a number of entries in cp/cp-tree.def which are marked as
> tcc_expression, although they seem to me to be better described as
> tcc_statement, to wit:
> In a quick look at the C++ front end, I can only find one bit of code
> which cares whether it is looking at a tcc_expression or a
> tcc_statement: value_dependent_expression_p in pt.c. That function
> will always return false for a statement. For all of the tree codes
> listed above, currently class tcc_expression, the function will call
> itself recursively on expression operands. I haven't tried to track
> all the calls to see whether any of the above codes can be passed to
> value_dependent_expression_p, but it doesn't seem likely.
None of the statement nodes you mention can be value dependent. If
that's the only place that cares, they should be tcc_statement.
> Anyhow, I'm testing the obvious patch to use tcc_statement instead of
> tcc_expression in cp-tree.def, and I will submit it to gcc-patches if
> it works. At the moment I'm curious as to whether anybody has a
> reason why these codes should be tcc_expression rather than
> tcc_statement.
I cannot think of any.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
More information about the Gcc
mailing list