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: [RFC] Add UNARY_PLUS_EXPR to C++ front-end


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


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