Patchwork [C++] PR 51150

login
register
mail settings
Submitter Paolo Carlini
Date Nov. 18, 2011, 1:43 p.m.
Message ID <4EC660E6.9020504@oracle.com>
Download mbox | patch
Permalink /patch/126408/
State New
Headers show

Comments

Paolo Carlini - Nov. 18, 2011, 1:43 p.m.
On 11/18/2011 02:29 PM, Paolo Carlini wrote:
> On 11/18/2011 02:27 PM, Paolo Carlini wrote:
>> On 11/18/2011 02:16 PM, Jason Merrill wrote:
>>> On 11/17/2011 06:52 PM, Paolo Carlini wrote:
>>>> The problem is, in all these tests,
>>>> value is always a FIX_TRUNC_EXPR, which, AFAICS, is always left
>>>> untouched.
>>> Aha, I guess tsubst_copy_and_build needs to handle FIX_TRUNC_EXPR 
>>> better.
>> I see. Maybe better if you handle this issue, I have very little 
>> clues about the right way to do that, see, in the whole cp/ I count 
>> only try occurrences of FIX_TRUNC_EXPR overall ;)
> I meant 4, including one in error.c. You see my point.
Well, unless there are hopes that something as simple as the attached is 
all there is to it: works for the testcase, but I haven't run the 
testsuite...

Paolo.

////////////////
Jason Merrill - Nov. 18, 2011, 1:53 p.m.
I think let's go straight to cp_build_unary_op from 
tsubst_copy_and_build in this case; it can't be overloaded, and we don't 
want to mess with build_non_dependent_expr.

Jason

Patch

Index: pt.c
===================================================================
--- pt.c	(revision 181474)
+++ pt.c	(working copy)
@@ -13384,6 +13384,7 @@  tsubst_copy_and_build (tree t,
     case UNARY_PLUS_EXPR:  /* Unary + */
     case REALPART_EXPR:
     case IMAGPART_EXPR:
+    case FIX_TRUNC_EXPR:
       return build_x_unary_op (TREE_CODE (t), RECUR (TREE_OPERAND (t, 0)),
                                complain);
 
Index: call.c
===================================================================
--- call.c	(revision 181474)
+++ call.c	(working copy)
@@ -5227,6 +5227,7 @@  build_new_op_1 (enum tree_code code, int flags, tr
     case REALPART_EXPR:
     case IMAGPART_EXPR:
     case ABS_EXPR:
+    case FIX_TRUNC_EXPR:
       return cp_build_unary_op (code, arg1, candidates != 0, complain);
 
     case ARRAY_REF: