public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "reichelt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60219] New: [4.8/4.9 Regression] [c++11] ICE invalid use of variadic template
Date: Sat, 15 Feb 2014 22:58:00 -0000	[thread overview]
Message-ID: <bug-60219-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 60219
           Summary: [4.8/4.9 Regression] [c++11] ICE invalid use of
                    variadic template
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: diagnostic, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-std=c++11") triggers
an ICE since GCC 4.8.0:

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

void bar()
{
  foo<0>;
}
=============================================

bug.cc: In function 'void bar()':
bug.cc:5:9: internal compiler error: tree check: accessed elt 3 of tree_vec
with 2 elts in coerce_template_parms, at cp/pt.c:6857
   foo<0>;
         ^
0xdca805 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9377
0x61aa12 tree_vec_elt_check
        ../../gcc/gcc/tree.h:2899
0x61aa12 coerce_template_parms
        ../../gcc/gcc/cp/pt.c:6857
0x633577 resolve_nondeduced_context(tree_node*)
        ../../gcc/gcc/cp/pt.c:16561
0x6f9907 convert_to_void(tree_node*, impl_conv_void, int)
        ../../gcc/gcc/cp/cvt.c:1244
0x726d8a finish_expr_stmt(tree_node*)
        ../../gcc/gcc/cp/semantics.c:684
0x6ae3e8 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9473
0x6af1b9 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9745
0x6af326 cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9699
0x6c34fb cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18641
0x6c34fb cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18677
0x6c7842 cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22792
0x6c86e1 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:22704
0x6c86e1 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16585
0x6c9979 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11205
0x6acc63 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:11086
0x6d3f12 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10983
0x6d2c08 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10869
0x6d44aa cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6d44aa c_parse_file()
        ../../gcc/gcc/cp/parser.c:31536
Please submit a full bug report, [etc.]

If I actually try to call foo<0>, I get a broken diagnostic ending in a colon:

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

void bar()
{
  foo<0>();
}
==============================================

bug.cc: In function 'void bar()':
bug.cc:5:10: error: no matching function for call to 'foo()'
   foo<0>();
          ^
bug.cc:5:10: note: candidate is:
bug.cc:1:33: note: template<class ..., int <anonymous> > void foo()
 template<typename..., int> void foo();
                                 ^
bug.cc:1:33: note:   template argument deduction/substitution failed:

Why?


             reply	other threads:[~2014-02-15 22:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-15 22:58 reichelt at gcc dot gnu.org [this message]
2014-02-15 22:58 ` [Bug c++/60219] " reichelt at gcc dot gnu.org
2014-02-16 19:35 ` reichelt at gcc dot gnu.org
2014-02-17 10:05 ` jakub at gcc dot gnu.org
2014-02-17 12:27 ` rguenth at gcc dot gnu.org
2014-02-21  6:06 ` jason at gcc dot gnu.org
2014-02-21 14:57 ` jason at gcc dot gnu.org
2014-02-21 15:30 ` jason at gcc dot gnu.org
2014-02-21 15:55 ` jason at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-60219-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).