public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "benbarsdell at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/114303] New: ICE with constexpr if and static_assert accessing captures across nested generic lambdas
Date: Mon, 11 Mar 2024 11:07:54 +0000	[thread overview]
Message-ID: <bug-114303-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114303

            Bug ID: 114303
           Summary: ICE with constexpr if and static_assert accessing
                    captures across nested generic lambdas
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: benbarsdell at gmail dot com
  Target Milestone: ---

Similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105788 but the
backtrace is different.

https://godbolt.org/z/xMPeTo633

Repros with the following versions on Godbolt:
14.0.1 ICE (gcc trunk on Godbolt)
13.2: ICE
13.1: ICE
12.3: ICE
12.2: OK
12.1: OK
11.4: ICE
11.3: OK


#include <type_traits>

int main() {
    auto foo = [](auto level1) {
        return [&](auto ) {
            return [&](auto level3) {
                if constexpr (decltype(level3)::value) {
                    static_assert(decltype(level1)::value, "");
                }
                return 0;
            }(std::integral_constant<int, 1>());
        }(0);
    }(std::integral_constant<int, 1>());
}


<source>:8:17: internal compiler error: trying to capture 'level1' in
instantiation of generic lambda
    8 |                 if constexpr (decltype(level3)::value) {
      |                 ^~
0x265eabc internal_error(char const*, ...)
        ???:0
0xb86956 add_capture(tree_node*, tree_node*, tree_node*, bool, bool, unsigned
int*)
        ???:0
0xb869d9 add_default_capture(tree_node*, tree_node*, tree_node*)
        ???:0
0x16c682c walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        ???:0
0x16c68a9 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        ???:0
0xc75f26 build_extra_args(tree_node*, tree_node*, int)
        ???:0
0xcab766 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xc919b3 instantiate_decl(tree_node*, bool, bool)
        ???:0
0xb54725 maybe_instantiate_decl(tree_node*)
        ???:0
...

             reply	other threads:[~2024-03-11 11:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11 11:07 benbarsdell at gmail dot com [this message]
2024-03-11 12:46 ` [Bug c++/114303] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2024-03-11 12:48 ` [Bug c++/114303] [11/12/13/14 Regression] ICE with constexpr if and " pinskia at gcc dot gnu.org
2024-03-11 14:43 ` ppalka at gcc dot gnu.org
2024-03-15 15:01 ` law at gcc dot gnu.org
2024-03-25 12:52 ` rguenth at gcc dot gnu.org
2024-04-11 14:17 ` cvs-commit at gcc dot gnu.org
2024-04-12 20:04 ` [Bug c++/114303] [11/12/13 " ppalka at gcc dot gnu.org
2024-05-14  2:58 ` cvs-commit 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-114303-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).