Patchwork [C++] PR 50901

login
register
mail settings
Submitter Paolo Carlini
Date Oct. 29, 2011, 2:02 a.m.
Message ID <4EAB5EA4.2070705@oracle.com>
Download mbox | patch
Permalink /patch/122522/
State New
Headers show

Comments

Paolo Carlini - Oct. 29, 2011, 2:02 a.m.
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.carlini@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.carlini@oracle.com>

	PR c++/50901
	* g++.dg/cpp0x/pr50901.C: New.
Jason Merrill - Oct. 29, 2011, 12:28 p.m.
OK.

Jason

Patch

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: