Hi,

this is a rather nasty 4.6/4.7 Regression, ice-on-valid, and the fix seems simple. Anyway, tested (for real ;) on x86_64-linux.

Ok mainline and branch?

Thanks,
Paolo.

/////////////////
/cp
2011-10-28  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/50901
        * call.c (build_new_op_1): Handle ABS_EXPR together with the
        other unary EXPR.

/testsuite
2011-10-28  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/50901
        * g++.dg/cpp0x/pr50901.C: New.

Index: testsuite/g++.dg/cpp0x/pr50901.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr50901.C    (revision 0)
+++ testsuite/g++.dg/cpp0x/pr50901.C    (revision 0)
@@ -0,0 +1,9 @@
+// { dg-options "-std=c++0x" }
+
+template<class T> int foo(int a)
+{
+  const unsigned b = a < 0 ? -a : a;
+  return 0;
+}
+
+int i = foo<float>(1);
Index: cp/call.c
===================================================================
--- cp/call.c   (revision 180626)
+++ cp/call.c   (working copy)
@@ -5223,6 +5223,7 @@ build_new_op_1 (enum tree_code code, int flags, tr
     case POSTDECREMENT_EXPR:
     case REALPART_EXPR:
     case IMAGPART_EXPR:
+    case ABS_EXPR:
       return cp_build_unary_op (code, arg1, candidates != 0, complain);
 
     case ARRAY_REF:

Reply via email to