re PR c++/63522 (ICE: unexpected expression 'ElementIndices' of kind template_parm_index)
authorJason Merrill <jason@redhat.com>
Thu, 25 Dec 2014 07:27:54 +0000 (02:27 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 25 Dec 2014 07:27:54 +0000 (02:27 -0500)
PR c++/63522
* parser.c (cp_parser_type_parameter): Call
check_for_bare_parameter_packs on default argument.

From-SVN: r219066

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp0x/variadic164.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/vt-34052.C

index cf5ab7102b5597a7f2826ae574e7d1e936e94da9..4eb87127342836b429f35ecaaf20c41733c28bc3 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-25  Jason Merrill  <jason@redhat.com>
+
+       PR c++/63522
+       * parser.c (cp_parser_type_parameter): Call
+       check_for_bare_parameter_packs on default argument.
+
 2014-12-24  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/63985
index e57a5bd680281800c2e920e87723fd66641c37f8..2af15763ce36e2bb51f7cd610ab241ee2ac41bcb 100644 (file)
@@ -13499,6 +13499,8 @@ cp_parser_type_parameter (cp_parser* parser, bool *is_parameter_pack)
                            "default arguments");
                 default_argument = NULL_TREE;
               }
+           else if (check_for_bare_parameter_packs (default_argument))
+             default_argument = error_mark_node;
            pop_deferring_access_checks ();
          }
        else
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic164.C b/gcc/testsuite/g++.dg/cpp0x/variadic164.C
new file mode 100644 (file)
index 0000000..8f9cdb1
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/63522
+// { dg-do compile { target c++11 } }
+
+template <typename...> struct tuple;
+template <typename...> void slice();
+template <int Index, typename...> using slice_result = decltype(slice<Index>);
+template <typename Tuple, typename... Tuples, int... ElementIndices,
+          typename =
+              typename tuple<slice_result<ElementIndices, Tuples...>,
+                             slice_result<ElementIndices, Tuples...>...>::type> // { dg-error "parameter pack" }
+void zip_with(Tuple...);
+decltype(zip_with(0)) d;       // { dg-error "no match" }
index 1036537eb9c405d0b60cc23258f6fdd3b8308f12..31d283131a3996ae9eb187f7b5466683c1a2c915 100644 (file)
@@ -1,8 +1,8 @@
 // { dg-do compile { target c++11 } }
-template<typename... T, typename = T> struct A {}; // { dg-error "must be at the end" }
+template<typename... T, typename = T> struct A {}; // { dg-error "parameter pack" }
 
 
-template<template<typename... T, typename = T> class U> struct B // { dg-error "must be at the end" }
+template<template<typename... T, typename = T> class U> struct B // { dg-error "parameter pack" }
 {
-  template<int> U<int> foo(); // { dg-error "mismatch|constant|invalid|invalid" }
+  template<int> U<int> foo(); // { dg-error "mismatch|constant|wrong|invalid" }
 };