PR c++/84454 - ICE with pack expansion in signature.
authorJason Merrill <jason@redhat.com>
Wed, 21 Feb 2018 14:25:54 +0000 (09:25 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 21 Feb 2018 14:25:54 +0000 (09:25 -0500)
* error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.

From-SVN: r257875

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

index dd408e0bf68709b0e314e75fc41a88786cbaeab7..76dce820aa8d0283e7006fa78a25d4227270701d 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-21  Jason Merrill  <jason@redhat.com>
+
+       PR c++/84454 - ICE with pack expansion in signature.
+       * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
+
 2018-02-20  Siddhesh Poyarekar  <siddhesh@sourceware.org>
 
        * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
index cb1dcf362013eed259bae0890986f363471b334e..75e853a14288b6440a4aafe33ec3d38fad0eca80 100644 (file)
@@ -1472,7 +1472,7 @@ find_typenames_r (tree *tp, int *walk_subtrees, void *data)
     /* Add the typename without any cv-qualifiers.  */
     mv = TYPE_MAIN_VARIANT (*tp);
 
-  if (TREE_CODE (*tp) == TYPE_PACK_EXPANSION)
+  if (PACK_EXPANSION_P (*tp))
     {
       /* Don't mess with parameter packs since we don't remember
         the pack expansion context for a particular typename.  */
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic172.C b/gcc/testsuite/g++.dg/cpp0x/variadic172.C
new file mode 100644 (file)
index 0000000..d25d302
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/84454
+// { dg-do compile { target c++11 } }
+
+template<class F, class... A>
+void
+g(F&&, A&&...)
+{}
+
+template<class... A>
+auto
+h(A&&... a) -> decltype(g(0, g<decltype(a)>(a)...))
+{
+  g(a...);                     // { dg-error "no match" }
+}
+
+int
+main()
+{
+  h();
+}