This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix 20186
On Wed, 09 Mar 2005 17:59:16 +0000, Nathan Sidwell <nathan@codesourcery.com> wrote:
> Mark Mitchell wrote:
>> Nathan Sidwell wrote:
>>
>>> 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?
>>[code snipped]
> This is checking whether the target type is dependent, NOT the source
> type.
But it *should* check the source type. T is a dependent type, so "t" is
value-dependent, and so the cast is value-dependent.
We don't need a new predicate.
Jason