public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hewillk at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99831] ICE: in reshape_init, at cp/decl.c:6720 Date: Tue, 30 Mar 2021 17:43:13 +0000 [thread overview] Message-ID: <bug-99831-4-rAuk4QGpHb@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99831-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99831 --- Comment #4 from 康桓瑋 <hewillk at gmail dot com> --- When the array subscript is outside the bounds of array, gcc seems to fall into infinite recursion due to the default operator==. Here is the reduced with no header: struct A { constexpr A(const char*) {} char value[1] = {}; }; template <A> struct B { constexpr bool operator==(const B&) const = default; }; constexpr auto foo(auto) { constexpr auto a = [] { char value[1]; value[2] = 0; // this line return A{value}; }(); return B<a>{}; } constexpr auto b = foo(B<"">{}); <source>: In instantiation of 'struct B<<expression error> >': <source>:8:18: recursively required from 'struct B<<expression error> >' <source>:8:18: required from 'struct B<<expression error> >' <source>:17:15: required from 'constexpr auto foo(auto:1) [with auto:1 = B<A{""}>]' <source>:20:23: required from here <source>:8:18: fatal error: template instantiation depth exceeds maximum of 900 (use '-ftemplate-depth=' to increase the maximum) 8 | constexpr bool operator==(const B&) const = default; | ^~~~~~~~ compilation terminated.
next prev parent reply other threads:[~2021-03-30 17:43 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-30 14:27 [Bug c++/99831] New: " hewillk at gmail dot com 2021-03-30 14:34 ` [Bug c++/99831] " hewillk at gmail dot com 2021-03-30 14:41 ` mpolacek at gcc dot gnu.org 2021-03-30 15:04 ` mpolacek at gcc dot gnu.org 2021-03-30 17:43 ` hewillk at gmail dot com [this message] 2021-03-30 19:14 ` mpolacek at gcc dot gnu.org 2021-03-30 19:34 ` mpolacek at gcc dot gnu.org 2021-03-30 19:46 ` mpolacek at gcc dot gnu.org 2021-03-30 19:51 ` mpolacek at gcc dot gnu.org 2021-03-31 1:04 ` mpolacek at gcc dot gnu.org 2021-03-31 7:54 ` [Bug c++/99831] [10/11 Regression] " rguenth at gcc dot gnu.org 2021-04-01 18:18 ` mpolacek at gcc dot gnu.org 2021-04-01 21:35 ` cvs-commit at gcc dot gnu.org 2021-04-01 21:37 ` [Bug c++/99831] [10 " mpolacek at gcc dot gnu.org 2021-04-08 12:02 ` rguenth at gcc dot gnu.org 2021-04-09 22:45 ` cvs-commit at gcc dot gnu.org 2021-04-09 22:46 ` mpolacek 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-99831-4-rAuk4QGpHb@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: linkBe 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).