public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114303] New: ICE with constexpr if and static_assert accessing captures across nested generic lambdas
@ 2024-03-11 11:07 benbarsdell at gmail dot com
  2024-03-11 12:46 ` [Bug c++/114303] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: benbarsdell at gmail dot com @ 2024-03-11 11:07 UTC (permalink / raw)
  To: gcc-bugs

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
...

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-14  2:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 11:07 [Bug c++/114303] New: ICE with constexpr if and static_assert accessing captures across nested generic lambdas benbarsdell at gmail dot com
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

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).