public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60065] New: [c++1y] ICE with auto parameter pack
@ 2014-02-04 21:10 reichelt at gcc dot gnu.org
  2014-02-20  1:41 ` [Bug c++/60065] " abutcher at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-04 21:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60065

            Bug ID: 60065
           Summary: [c++1y] ICE with auto parameter pack
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following line of code (compiled with "-std=c++1y") triggers an ICE on
trunk:

========================================
template<int> void foo(auto... x);
========================================

bug.cc:1:32: internal compiler error: tree check: expected template_type_parm
or template_template_parm or bound_template_template_parm, have integer_type in
convert_generic_types_to_packs, at cp/pt.c:21726
 template<int> void foo(auto... x);
                                ^
0xdc4824 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9192
0x64ad63 tree_check3
        ../../gcc/gcc/tree.h:2749
0x64ad63 convert_generic_types_to_packs(tree_node*, int, int)
        ../../gcc/gcc/cp/pt.c:21726
0x6c8f47 cp_parser_parameter_declaration_list
        ../../gcc/gcc/cp/parser.c:18279
0x6c9532 cp_parser_parameter_declaration_clause
        ../../gcc/gcc/cp/parser.c:18179
0x6bfd05 cp_parser_direct_declarator
        ../../gcc/gcc/cp/parser.c:17072
0x6bfd05 cp_parser_declarator
        ../../gcc/gcc/cp/parser.c:16943
0x6ca599 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16496
0x6cb41a cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:23113
0x6cb704 cp_parser_template_declaration_after_export
        ../../gcc/gcc/cp/parser.c:22915
0x6d6af9 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10947
0x6d55e8 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10869
0x6d6eca cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6d6eca c_parse_file()
        ../../gcc/gcc/cp/parser.c:31528
0x7f6973 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]

The code compiles if I remove the 'x' or replace 'int' by 'typename'.
I'm not sure whether the code is valid or not, though.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/60065] [c++1y] ICE with auto parameter pack
  2014-02-04 21:10 [Bug c++/60065] New: [c++1y] ICE with auto parameter pack reichelt at gcc dot gnu.org
@ 2014-02-20  1:41 ` abutcher at gcc dot gnu.org
  2014-02-20  3:05 ` abutcher at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: abutcher at gcc dot gnu.org @ 2014-02-20  1:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60065

Adam Butcher <abutcher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abutcher at gcc dot gnu.org

--- Comment #1 from Adam Butcher <abutcher at gcc dot gnu.org> ---
I think it is valid.  It should be considered equivalent to:

  template <int, typename... T> void foo(T... x);

Looks like the generic parameter pack 'auto...' is replacing the template
argument list rather than extending it.  I'll look into it.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/60065] [c++1y] ICE with auto parameter pack
  2014-02-04 21:10 [Bug c++/60065] New: [c++1y] ICE with auto parameter pack reichelt at gcc dot gnu.org
  2014-02-20  1:41 ` [Bug c++/60065] " abutcher at gcc dot gnu.org
@ 2014-02-20  3:05 ` abutcher at gcc dot gnu.org
  2014-02-25  3:48 ` abutcher at gcc dot gnu.org
  2014-02-25 21:20 ` reichelt at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: abutcher at gcc dot gnu.org @ 2014-02-20  3:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60065

--- Comment #2 from Adam Butcher <abutcher at gcc dot gnu.org> ---
Turns out the base template parameter index was not been initialized correctly
so it was trying to convert the 'int' parameter to a pack as well as the
invented template parameter generated for the 'auto'.  See
http://gcc.gnu.org/ml/gcc-patches/2014-02/msg01197.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/60065] [c++1y] ICE with auto parameter pack
  2014-02-04 21:10 [Bug c++/60065] New: [c++1y] ICE with auto parameter pack reichelt at gcc dot gnu.org
  2014-02-20  1:41 ` [Bug c++/60065] " abutcher at gcc dot gnu.org
  2014-02-20  3:05 ` abutcher at gcc dot gnu.org
@ 2014-02-25  3:48 ` abutcher at gcc dot gnu.org
  2014-02-25 21:20 ` reichelt at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: abutcher at gcc dot gnu.org @ 2014-02-25  3:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60065

--- Comment #3 from Adam Butcher <abutcher at gcc dot gnu.org> ---
Author: abutcher
Date: Tue Feb 25 03:47:24 2014
New Revision: 208106

URL: http://gcc.gnu.org/viewcvs?rev=208106&root=gcc&view=rev
Log:
Fix PR c++/60065.

    PR c++/60065
    * parser.c (cp_parser_direct_declarator): Don't save and
    restore num_template_parameter_lists around call to
    cp_parser_parameter_declaration_list.
    (function_being_declared_is_template_p): New predicate.
    (cp_parser_parameter_declaration_list): Use
    function_being_declared_is_template_p as predicate for
    inspecting current function template parameter list length
    rather than num_template_parameter_lists.

    PR c++/60065
    * g++.dg/cpp1y/pr60065.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/pr60065.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/60065] [c++1y] ICE with auto parameter pack
  2014-02-04 21:10 [Bug c++/60065] New: [c++1y] ICE with auto parameter pack reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-02-25  3:48 ` abutcher at gcc dot gnu.org
@ 2014-02-25 21:20 ` reichelt at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-25 21:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60065

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.9.0
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0
      Known to fail|4.9.0                       |

--- Comment #4 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Fixed by Adam's patch.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-25 21:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-04 21:10 [Bug c++/60065] New: [c++1y] ICE with auto parameter pack reichelt at gcc dot gnu.org
2014-02-20  1:41 ` [Bug c++/60065] " abutcher at gcc dot gnu.org
2014-02-20  3:05 ` abutcher at gcc dot gnu.org
2014-02-25  3:48 ` abutcher at gcc dot gnu.org
2014-02-25 21:20 ` reichelt at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).