public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58637] New: [c++1y] ICE with wrong usage of template<> in front of function containing auto parameter
@ 2013-10-05 22:41 reichelt at gcc dot gnu.org
  2013-11-12 20:17 ` [Bug c++/58637] " abutcher at gcc dot gnu.org
  2013-11-13  6:49 ` reichelt at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-05 22:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58637
           Summary: [c++1y] ICE with wrong usage of template<> in front of
                    function containing auto parameter
           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 invalid line of code (compiled with "-std=c++1y") triggers an ICE
on trunk (since at least 4.9.0-20130920):

=============================
template<> void foo(auto);
=============================

bug.cc:1:21: internal compiler error: in add_implicit_template_parms, at
cp/parser.c:28978
 template<> void foo(auto);
                     ^
0x64f044 add_implicit_template_parms
        ../../gcc/gcc/cp/parser.c:28978
0x64f044 cp_parser_parameter_declaration_list
        ../../gcc/gcc/cp/parser.c:18067
0x64f356 cp_parser_parameter_declaration_clause
        ../../gcc/gcc/cp/parser.c:17882
0x649f04 cp_parser_direct_declarator
        ../../gcc/gcc/cp/parser.c:16834
0x649f04 cp_parser_declarator
        ../../gcc/gcc/cp/parser.c:16705
0x650cc7 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16268
0x651fd4 cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:22665
0x6553fd cp_parser_explicit_specialization
        ../../gcc/gcc/cp/parser.c:13986
0x65cac5 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10726
0x65b5aa cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10659
0x65ce76 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65ce76 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28911
0x7708b3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]


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

* [Bug c++/58637] [c++1y] ICE with wrong usage of template<> in front of function containing auto parameter
  2013-10-05 22:41 [Bug c++/58637] New: [c++1y] ICE with wrong usage of template<> in front of function containing auto parameter reichelt at gcc dot gnu.org
@ 2013-11-12 20:17 ` abutcher at gcc dot gnu.org
  2013-11-13  6:49 ` reichelt at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: abutcher at gcc dot gnu.org @ 2013-11-12 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from abutcher at gcc dot gnu.org ---
Author: abutcher
Date: Tue Nov 12 20:17:33 2013
New Revision: 204714

URL: http://gcc.gnu.org/viewcvs?rev=204714&root=gcc&view=rev
Log:
Refactor implicit function template implementation and fix 58534, 58536, 58548,
58549 and 58637.

gcc/
    * tree.c (grow_tree_vec_stat): New function ...
    * tree.h (grow_tree_vec_stat) (grow_tree_vec): ... and its declaration
    and macro front-end.

gcc/cp/
    PR c++/58534
    PR c++/58536
    PR c++/58548
    PR c++/58549
    PR c++/58637
    * parser.h (struct cp_parser): New members implicit_template_parms,
    implicit_template_scope and auto_is_implicit_function_template_parm_p.
    * parser.c (add_implicit_template_parms): Refactor as ...
    (synthesize_implicit_template_parm): ... this to append a new template
    type parm to the current template parameter list (introducing a new list
    if necessary).  Removed push_deferring_access_checks.
    (finish_fully_implicit_template): Removed pop_deferring_access_checks.
    (cp_parser_new): Initialize new cp_parser members.
    (cp_parser_parameter_declaration_clause): Consider auto as implicit
    template parm when parsing a parameter declaration (unless parsing an
    explicit specialization).
    (cp_parser_parameter_declaration_list): Remove local
    implicit_template_parms counter and reset cp_parser implicit template
    state when complete.
    (cp_parser_lambda_expression): Reset implicit template cp_parser members
    whilst generating lambda class.
    (cp_parser_function_definition_after_declarator): Reset implicit
    template cp_parser members whilst parsing function definition.
    (make_generic_type_name): Respell '<autoN>' as 'auto:N' which works
    better with template diagnostics.
    (cp_parser_simple_type_specifier): Synthesize implicit template parm on
    parsing 'auto' if auto_is_implicit_function_template_parm_p and provide
    diagnostics ...
    * decl.c (grokdeclarator): ... that were previously done here.

gcc/testsuite/g++.dg/
    * cpp1y/pr58534.C: New testcase.
    * cpp1y/pr58536.C: New testcase.
    * cpp1y/pr58548.C: New testcase.
    * cpp1y/pr58549.C: New testcase.
    * cpp1y/pr58637.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/pr58534.C
    trunk/gcc/testsuite/g++.dg/cpp1y/pr58536.C
    trunk/gcc/testsuite/g++.dg/cpp1y/pr58548.C
    trunk/gcc/testsuite/g++.dg/cpp1y/pr58549.C
    trunk/gcc/testsuite/g++.dg/cpp1y/pr58637.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/parser.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree.c
    trunk/gcc/tree.h


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

* [Bug c++/58637] [c++1y] ICE with wrong usage of template<> in front of function containing auto parameter
  2013-10-05 22:41 [Bug c++/58637] New: [c++1y] ICE with wrong usage of template<> in front of function containing auto parameter reichelt at gcc dot gnu.org
  2013-11-12 20:17 ` [Bug c++/58637] " abutcher at gcc dot gnu.org
@ 2013-11-13  6:49 ` reichelt at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-11-13  6:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

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


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

end of thread, other threads:[~2013-11-13  6:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-05 22:41 [Bug c++/58637] New: [c++1y] ICE with wrong usage of template<> in front of function containing auto parameter reichelt at gcc dot gnu.org
2013-11-12 20:17 ` [Bug c++/58637] " abutcher at gcc dot gnu.org
2013-11-13  6:49 ` 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).