OSDN Git Service

PR c++/43054
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 12 Feb 2010 19:46:29 +0000 (19:46 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 12 Feb 2010 19:46:29 +0000 (19:46 +0000)
* tree.c (cp_tree_equal): Correct CALL_EXPR logic, handle
EXPR_PACK_EXPANSION.

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

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

index 18d1232..ba2fd04 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/43054
+       * tree.c (cp_tree_equal): Correct CALL_EXPR logic, handle
+       EXPR_PACK_EXPANSION.
+
 2010-02-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/43033
index 678c7dd..89ac3dd 100644 (file)
@@ -2060,7 +2060,9 @@ cp_tree_equal (tree t1, tree t2)
               arg2 = next_call_expr_arg (&iter2))
          if (!cp_tree_equal (arg1, arg2))
            return false;
-       return (arg1 || arg2);
+       if (arg1 || arg2)
+         return false;
+       return true;
       }
 
     case TARGET_EXPR:
@@ -2197,6 +2199,10 @@ cp_tree_equal (tree t1, tree t2)
       return same_type_p (TRAIT_EXPR_TYPE1 (t1), TRAIT_EXPR_TYPE1 (t2))
        && same_type_p (TRAIT_EXPR_TYPE2 (t1), TRAIT_EXPR_TYPE2 (t2));
 
+    case EXPR_PACK_EXPANSION:
+      return cp_tree_equal (PACK_EXPANSION_PATTERN (t1),
+                           PACK_EXPANSION_PATTERN (t2));
+
     default:
       break;
     }
index b93be3d..9ec83bf 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/43054
+       * g++.dg/cpp0x/variadic99.C: New.
+
 2010-02-12  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/guality/guality.h (GUALCVT): Zero extend instead of
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic99.C b/gcc/testsuite/g++.dg/cpp0x/variadic99.C
new file mode 100644 (file)
index 0000000..4572127
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/43054
+// { dg-options "-std=c++0x" }
+
+template<typename R> struct future { };
+
+template<typename Fn, typename... Args>
+ auto
+ async(Fn&& fn, Args&&... args)
+ -> future<decltype(fn(args...))>;
+
+template<typename Fn, typename... Args>
+ auto
+ async(Fn&& fn, Args&&... args)
+ -> future<decltype(fn(args...))>;
+
+int work2(int value);
+
+void work(int value)
+{
+  async(work2, value);
+}
+