public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pkeir at outlook dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59991] New: Recursive lambda capture in C++1y constexpr function template causes internal compiler error
Date: Wed, 29 Jan 2014 21:17:00 -0000	[thread overview]
Message-ID: <bug-59991-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 59991
           Summary: Recursive lambda capture in C++1y constexpr function
                    template causes internal compiler error
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pkeir at outlook dot com

Created attachment 31987
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31987&action=edit
The test case which produces the internal compiler error

The code below uses the C++1y feature of allowing declarations in constexpr
functions, but r should not be included in the lambda's capture list. There is
also an issue with excessive recursive template instantiation. In any case, the
code produces an internal compiler error starting with:

internal compiler error: in tsubst, at cp/pt.c:11350
   auto f = [r,x]() { return r(x); };

The full output and test case is attached. This was run under Ubuntu 13.10.

// $ g++ --version
// g++ (GCC) 4.9.0 20131201 (experimental)

template <typename T>
constexpr int r(T x) {
  auto f = [r,x]() { return r(x); };
  return 0;
}

int main(int argc, char *argv[])
{
  r(0);
  return 0;
}


             reply	other threads:[~2014-01-29 21:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29 21:17 pkeir at outlook dot com [this message]
2014-01-29 21:19 ` [Bug c++/59991] " pkeir at outlook dot com
2015-03-16 15:03 ` mpolacek at gcc dot gnu.org
2015-06-23  8:47 ` rguenth 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-59991-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).