This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][C++] PR 65071
- From: Andrea Azzarone <azzaronea at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Feb 2015 09:20:19 +0100
- Subject: Re: [PATCH][C++] PR 65071
- Authentication-results: sourceware.org; auth=none
- References: <CAGqc0-qYC+4mydJZrtg_4TQ5TZQ5UK_p85-+_gEt210Y18ddWw at mail dot gmail dot com>
Ops, forgot the diff.
2015-02-18 9:19 GMT+01:00 Andrea Azzarone <azzaronea@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 <azzaronea@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>{});