This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] PR 59571
- From: Jason Merrill <jason at redhat dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 17 Mar 2014 09:42:08 -0400
- Subject: Re: [C++ Patch] PR 59571
- Authentication-results: sourceware.org; auth=none
- References: <5326C29C dot 3080808 at oracle dot com>
On 03/17/2014 05:38 AM, Paolo Carlini wrote:
noticed this issue, which looks simple to fix. The ICE happens in
cxx_eval_constant_expression, because it cannot handle a CAST_EXPR (or
any othe *_CAST, for that matter). In fact check_narrowing calls
maybe_constant_value, and, because we are in a template, the latter
faces the unfolded CAST_EXPR. Thus it seems easy to just use
fold_non_dependent_expr_sfinae. Tested x86_64-linux.
OK.
PS: looking forward, I'm wondering if some semantics/typeck functions
shouldn't try harder before building a tree node and returning, eg,
instead of just checking processing_template_decl, actually checking if
type and expr are dependent? Does this kind of audit make sense for next
Stage 1?
In general adding fold_non_dependent_expr where it's needed is the right
answer, because normal operation creates tree patterns that tsubst
doesn't understand how to deal with.
I suppose it might work to always fully build
non-instantiation-dependent expressions, wrap them in
NON_DEPENDENT_EXPR, and then unshare its operand at instantiation time.
But that would be a significant change with unclear benefit.
Jason