This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix 20186


Nathan Sidwell wrote:
hi,
this patch fixes 20186 a recent c++ template regression.  We can't
fold non-dependent expressions that contain something dependent.  This
can happen with casts from a dependent type to a non-dependent type.
We abuse tsubst_copy to do the folding, and it goes horribly wrong.
This is really another case where we should mark such exprs as we build
them up ...

+ int i = static_cast<int>(t);

Why doesn't value_dependent_expression_p return true for that? It looks like it should, as "t" has dependent type, and we have this code:


/* These expressions are value-dependent if the type to which the

cast occurs is dependent or the expression being casted is

     value-dependent.  */
  if (TREE_CODE (expression) == DYNAMIC_CAST_EXPR
      || TREE_CODE (expression) == STATIC_CAST_EXPR
      || TREE_CODE (expression) == CONST_CAST_EXPR
      || TREE_CODE (expression) == REINTERPRET_CAST_EXPR
      || TREE_CODE (expression) == CAST_EXPR)
    {
      tree type = TREE_TYPE (expression);
      if (dependent_type_p (type))
        return true;

So, I'm perplexed as to how your patch could acutally change anything. (Insert comments about empiricists vs. theoreticians here. :-))

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]