/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 30 Oct 2011 00:22:53 +0000 (00:22 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 30 Oct 2011 00:22:53 +0000 (00:22 +0000)
2011-10-29  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-29  Paolo Carlini  <paolo.carlini@oracle.com>

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180670 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr50901.C [new file with mode: 0644]

index b25d362..64c932d 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50901
+       * call.c (build_new_op_1): Handle ABS_EXPR together with the
+       other unary EXPR.
+
 2011-10-28  Paolo Carlini  <paolo.carlini@oracle.com>
 
        Revert:
index 7e87bdf..439a1fe 100644 (file)
@@ -5223,6 +5223,7 @@ build_new_op_1 (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
     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:
index 598063e..d02c4bd 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50901
+       * g++.dg/cpp0x/pr50901.C: New.
+
 2011-10-29  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/fma-check.h (main): Use return 0 instead of exit (0).
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr50901.C b/gcc/testsuite/g++.dg/cpp0x/pr50901.C
new file mode 100644 (file)
index 0000000..439c15c
--- /dev/null
@@ -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);