From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4351 invoked by alias); 29 Jan 2014 21:17:40 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4328 invoked by uid 48); 29 Jan 2014 21:17:37 -0000 From: "pkeir at outlook dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pkeir at outlook dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg03118.txt.bz2 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 constexpr int r(T x) { auto f = [r,x]() { return r(x); }; return 0; } int main(int argc, char *argv[]) { r(0); return 0; }