[Bug c++/65071] ICE on valid, sizeof...() of template template parameter pack in return type

2015-07-14 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65071

--- Comment #4 from paolo at gcc dot gnu.org paolo at gcc dot gnu.org ---
Author: paolo
Date: Tue Jul 14 22:36:50 2015
New Revision: 225793

URL: https://gcc.gnu.org/viewcvs?rev=225793root=gccview=rev
Log:
/cp
2015-07-14  Andrea Azzarone  azzaro...@gmail.com

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

/testsuite
2015-07-14  Andrea Azzarone  azzaro...@gmail.com

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

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/vt-65071.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog


[Bug c++/65071] ICE on valid, sizeof...() of template template parameter pack in return type

2015-07-14 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65071

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |6.0

--- Comment #5 from Paolo Carlini paolo.carlini at oracle dot com ---
Fixed.


[Bug c++/65071] ICE on valid, sizeof...() of template template parameter pack in return type

2015-03-16 Thread maltsevm at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65071

--- Comment #3 from Mikhail Maltsev maltsevm at gmail dot com ---
For the record: a patch for this PR
https://gcc.gnu.org/ml/gcc-patches/2015-02/msg01067.html


[Bug c++/65071] ICE on valid, sizeof...() of template template parameter pack in return type

2015-03-16 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65071

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-03-16
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Marek Polacek mpolacek at gcc dot gnu.org ---
I can confirm the ICE.


[Bug c++/65071] ICE on valid, sizeof...() of template template parameter pack in return type

2015-02-15 Thread maltsevm at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65071

--- Comment #1 from Mikhail Maltsev maltsevm at gmail dot com ---
A few more comments. I wrote that GCC 5.0 segfaults. That's actually not true,
I could not reproduce segfault on checked builds (only release version of
4.9.2), but never the less it's still ICE.

So, here is a bit more minimized example:

$ cat ice_sizeof.cc
templateint struct S { };

templatetemplateint class... T, int N
Ssizeof...(T) foo(TN...);

auto x = foo(S2{});

==

The problem occurs during name mangling. I defined
#define DEBUG_MANGLE 1
The debug output (before ICE happens) ends with this:

  identifier  : S
  ++ add_substitution (template_decl at 0x7fb804560100)
  ++ substitutions   S-1_ = foo (template_decl at 0x7fb804560400)
 S0_ = S (template_decl at 0x7fb804560100)
  template-arg: integer_cst  (0x7fb80441c570)
  type: integer_type (0x7fb8043fe690)
  ++ find_substitution (integer_type at 0x7fb8043fe690)
  bare-function-type  : function_type(0x7fb804552c78)
  type: record_type  (0x7fb804552930)
  ++ find_substitution (record_type at 0x7fb804552930)
  name: type_decl(0x7fb80454e5f0)
  unscoped-template-name  : template_decl(0x7fb804560100)
  ++ find_substitution (template_decl at 0x7fb804560100)
  substitution:
  template-args   : tree_vec (0x7fb80455cca0)
  template-arg: sizeof_expr  (0x7fb80455cc60)
  type: type_pack_expansion  (0x7fb804552888)
  ++ find_substitution (type_pack_expansion at 0x7fb804552888)
  type: template_decl(0x7fb804560280)
  ++ find_substitution (template_decl at 0x7fb804560280)

If I understand correctly, tree_class_check fails when we attempt to mangle the
argument of sizeof...(T). It is (probably) represented through parameter pack
expansion (sizeof...(T) must have the same value as the number of parameters in
the pack TN...), which in turn depends on substitution of template template
parameter T. Template template parameters are represented using TEMPLATE_DECL:
...
  else if (code == TEMPLATE_DECL)
/* A template appearing as a template arg is a template template arg. */
write_template_template_arg (node);
...
And write_CV_qualifiers_for_type rejects it.