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++/58597] New: [c++11] ICE with lambda in default argument of template function
Date: Wed, 02 Oct 2013 20:25:00 -0000	[thread overview]
Message-ID: <bug-58597-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 58597
           Summary: [c++11] ICE with lambda in default argument of
                    template function
           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 valid code snippet (compiled with "-std=c++11") triggers an ICE
since GCC 4.5.0 (when lambdas were introduced):

===============================================================
template<typename> struct A
{
  template<typename T> A(T, int = []{ return 0; }()) {}
};

A<int> a = 0;
===============================================================

bug.cc: In substitution of 'template<class T> A< <template-parameter-1-1>
>::A(T, int) [with T = int]':
bug.cc:6:12:   required from here
bug.cc:6:12: internal compiler error: in instantiate_template_1, at
cp/pt.c:15008
 A<int> a = 0;
            ^
0x5d0b93 instantiate_template_1
        ../../gcc/gcc/cp/pt.c:15008
0x5d0b93 instantiate_template(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/pt.c:15117
0x5d264a fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc/gcc/cp/pt.c:15466
0x53f0fc add_template_candidate_real
        ../../gcc/gcc/cp/call.c:2923
0x53ae69 add_template_candidate
        ../../gcc/gcc/cp/call.c:3020
0x53ae69 add_candidates
        ../../gcc/gcc/cp/call.c:5075
0x53bd40 build_user_type_conversion_1
        ../../gcc/gcc/cp/call.c:3484
0x546013 build_user_type_conversion(tree_node*, tree_node*, int, int)
        ../../gcc/gcc/cp/call.c:3653
0x6843da ocp_convert(tree_node*, tree_node*, int, int, int)
        ../../gcc/gcc/cp/cvt.c:865
0x6913dd expand_default_init
        ../../gcc/gcc/cp/init.c:1597
0x6913dd expand_aggr_init_1
        ../../gcc/gcc/cp/init.c:1766
0x693b79 build_aggr_init(tree_node*, tree_node*, int, int)
        ../../gcc/gcc/cp/init.c:1517
0x557da5 build_aggr_init_full_exprs
        ../../gcc/gcc/cp/decl.c:5543
0x557da5 check_initializer
        ../../gcc/gcc/cp/decl.c:5678
0x56aa5c cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6347
0x65196f cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16567
0x65207f cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10986
0x653ee0 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x65cf1e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65bc8a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
Please submit a full bug report, [etc.]


             reply	other threads:[~2013-10-02 20:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02 20:25 reichelt at gcc dot gnu.org [this message]
2013-10-03 10:36 ` [Bug c++/58597] " mpolacek at gcc dot gnu.org
2013-10-03 10:36 ` mpolacek at gcc dot gnu.org
2013-10-04  1:12 ` paolo.carlini at oracle dot com
2015-01-14  8:02 ` reichelt at gcc dot gnu.org
2015-01-16 16:52 ` [Bug c++/58597] [5.0 Regression] " paolo.carlini at oracle dot com
2015-01-27 21:41 ` [Bug c++/58597] [5 " jason at gcc dot gnu.org
2015-01-27 23:21 ` jason at gcc dot gnu.org
2015-01-28 17:36 ` 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-58597-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).