This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix 20186
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 09 Mar 2005 09:56:03 -0800
- Subject: Re: [PATCH] Fix 20186
- Organization: CodeSourcery, LLC
- References: <422EF6FA.70109@codesourcery.com>
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