re PR c++/65071 (ICE on valid, sizeof...() of template template parameter pack in...
authorAndrea Azzarone <azzaronea@gmail.com>
Tue, 14 Jul 2015 22:36:50 +0000 (22:36 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 14 Jul 2015 22:36:50 +0000 (22:36 +0000)
/cp
2015-07-14  Andrea Azzarone  <azzaronea@gmail.com>

PR c++/65071
* parser.c (cp_parser_sizeof_pack): Also consider template template
parameters.

/testsuite
2015-07-14  Andrea Azzarone  <azzaronea@gmail.com>

PR c++/65071
* g++.dg/cpp0x/vt-65071.C: New.

From-SVN: r225793

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

index 904fc76386fedb210768fd4ba0c8f7eb65130410..ec50f75558cdf0372f42b022c922ce09ed4677cf 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-14  Andrea Azzarone  <azzaronea@gmail.com>
+
+       PR c++/65071
+       * parser.c (cp_parser_sizeof_pack): Also consider template template
+       parameters.
+
 2015-07-14  Jason Merrill  <jason@redhat.com>
 
        * call.c (build_new_method_call_1): Call reshape_init.
index f4e1ee11c7b06a6e86905d205c994c02904373ab..574ffba3ecec5e6246f458533547d10c834c7f9c 100644 (file)
@@ -24468,7 +24468,7 @@ cp_parser_sizeof_pack (cp_parser *parser)
   if (expr == error_mark_node)
     cp_parser_name_lookup_error (parser, name, expr, NLE_NULL,
                                 token->location);
-  if (TREE_CODE (expr) == TYPE_DECL)
+  if (TREE_CODE (expr) == TYPE_DECL || TREE_CODE (expr) == TEMPLATE_DECL)
     expr = TREE_TYPE (expr);
   else if (TREE_CODE (expr) == CONST_DECL)
     expr = DECL_INITIAL (expr);
index 6dd4feb719d75b52ec9c13cd03de2b1d5d2bef0d..e7a38b51ecc5ba7f971ea1ac2e794b1ef51d86f5 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-14  Andrea Azzarone  <azzaronea@gmail.com>
+
+       PR c++/65071
+       * g++.dg/cpp0x/vt-65071.C: New.
+
 2015-07-14  Sandra Loosemore  <sandra@codesourcery.com>
            Cesar Philippidis  <cesar@codesourcery.com>
            Chung-Lin Tang  <cltang@codesourcery.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-65071.C b/gcc/testsuite/g++.dg/cpp0x/vt-65071.C
new file mode 100644 (file)
index 0000000..727ad79
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/65071
+// { dg-do compile { target c++11 } }
+
+template<int> struct S {};
+
+template<template<int> class... T, int N>
+S<sizeof...(T)> foo(T<N>...);
+
+auto x = foo(S<2>{});