[C++ RFC / Patch] PR 31260

Mark Mitchell mark@codesourcery.com
Mon Sep 24 00:02:00 GMT 2007


Paolo Carlini wrote:

> In the present case, we are crashing in tsubst, called from
> fold_non_dependent_expr. And TREE_TYPE (r) is already set. In general I
> don't think we have reasons to believe that fold_non_dependent_expr is
> safer than the open-code hunk which is replacing after 23789, quite to
> the contrary, it appears to be essentially equivalent, but *misses* a
> check on TREE_TYPE. In other terms, it seems to me that the second
> comment above still holds true. (By the way, I have also tried removing
> the fold_non_dependent_expr call completely, but the bootstrap fails in
> libstdc++)

It's true that tsubst_expr, etc., are (unfortunately) not idemopotent;
you can't safely do tsubst_expr (tsubst_expr (t)).  However, I don't
understand the logic of the comment that you've (re)-added.  In
particular, something like:

  dynamic_cast <S*> (some expression)

will have type "S*" if "S*" is not a dependent type.  But, that doesn't
mean that the expression is "at simple as it can get"; there may still
be substitutions to do in the expression.

I assume the crash is occurring because of the S3<S2> default argument
in your test case?  But, how does that relate to the crash that you're
seeing?

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list