This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Add UNARY_PLUS_EXPR to C++ front-end
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: "Roger Sayle" <roger at eyesopen dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 26 May 2005 11:40:42 +0200
- Subject: Re: [RFC] Add UNARY_PLUS_EXPR to C++ front-end
- References: <Pine.LNX.4.44.0505252239240.24612-100000@www.eyesopen.com>
Roger Sayle <roger@eyesopen.com> wrote:
> FAIL: g++.dg/template/nontype11.C (test for excess errors)
> The problem is that at template instantiation time, we're not folding
> UNARY_PLUS_EXPR of an INTEGER_CST to just an INTEGER_CST soon enough.
> Unfortunately, my "g++ fu" isn't strong enough to work out which one
> or two line change to the template instantiation code required to
> replace UNARY_PLUS_EXPR with it's TREE_OPERAND (t, 0) at the
> appropriate point. There are several places this could be done, but I
> thought I'd ask the list and solicit help for this final piece.
This should be performed by fold_if_not_in_template(). The problem is that this
function is currently just fold() under the covers. Previously, fold() would
strip away the CONVERT_EXPR, but now it probably ignores the new unknown node.
The point is of course that the C++ frontend should have its own folders and
never call fold(). Thus, my suggestion is to put a temporary hack within
fold_if_not_in_template(), adding a comment specifying that this code to strip
UNARY_PLUS_EXPR should be part of the yet-to-be-written C++-specific folder.
Giovanni Bajo