Core 1609
authorJason Merrill <jason@redhat.com>
Mon, 22 Apr 2013 18:50:35 +0000 (14:50 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 22 Apr 2013 18:50:35 +0000 (14:50 -0400)
Core 1609
* decl2.c (check_default_args): Check for pack expansion.

From-SVN: r198152

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

index b4680c276eb2117d22137b9b5aef9eaa50b1c991..0dada14784a7ec4963acd2446108a8c6f3416687 100644 (file)
@@ -1,5 +1,8 @@
 2013-04-22  Jason Merrill  <jason@redhat.com>
 
+       Core 1609
+       * decl2.c (check_default_args): Check for pack expansion.
+
        * mangle.c (write_type): Mangle decltype(auto).
 
 2013-04-19  Jason Merrill  <jason@redhat.com>
index 74e51a8036d3b0dc28f7df81287b72d08e21c1b1..8d2385d76ddff46c6bb8a373cc41c8675a66859c 100644 (file)
@@ -4463,7 +4463,7 @@ check_default_args (tree x)
     {
       if (TREE_PURPOSE (arg))
        saw_def = true;
-      else if (saw_def)
+      else if (saw_def && !PACK_EXPANSION_P (TREE_VALUE (arg)))
        {
          error ("default argument missing for parameter %P of %q+#D", i, x);
          TREE_PURPOSE (arg) = error_mark_node;
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic142.C b/gcc/testsuite/g++.dg/cpp0x/variadic142.C
new file mode 100644 (file)
index 0000000..83b2429
--- /dev/null
@@ -0,0 +1,9 @@
+// Core 1609
+// { dg-require-effective-target c++11 }
+
+template<typename... T>
+void f2(int a = 0, T... b, int c = 1);
+
+int main(){
+  f2<>(); // parameter a has the value 0 and parameter c has the value 1
+}