Ops, forgot the diff.

2015-02-18 9:19 GMT+01:00 Andrea Azzarone <azzaro...@gmail.com>:
> Hi all,
>
> this patch try to fix PR c++/65071 (ICE on valid, sizeof...() of
> template template parameter pack in return type).
>
> 2015-2-18 Andrea Azzarone <azzaro...@gmail.com>
>   PR c++/65071
>   * gcc/cp/parser.c (cp_parser_sizeof_pack) Also consider template
> template parameters.
>
> Thanks.
>
> --
> Andrea Azzarone



-- 
Andrea Azzarone
http://launchpad.net/~andyrock
http://wiki.ubuntu.com/AndreaAzzarone
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 220698)
+++ gcc/cp/parser.c	(working copy)
@@ -24369,7 +24369,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: gcc/testsuite/g++.dg/cpp0x/vt-65071.C
===================================================================
--- gcc/testsuite/g++.dg/cpp0x/vt-65071.C	(revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/vt-65071.C	(working copy)
@@ -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>{});

Reply via email to