public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99994] New: internal compiler error: trying to capture 'f' in instantiation of generic lambda within constraints_satisfied_p
@ 2021-04-09 12:44 ed at catmur dot uk
  2021-04-13  2:55 ` [Bug c++/99994] " cvs-commit at gcc dot gnu.org
  2021-04-13  2:57 ` ppalka at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ed at catmur dot uk @ 2021-04-09 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99994
           Summary: internal compiler error: trying to capture 'f' in
                    instantiation of generic lambda within
                    constraints_satisfied_p
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

In godbolt gcc 11.0.1 20210408:

int main() {
    auto f = [](int) { return true; };
    return [&](auto i) requires (f(sizeof(i))) { return 99; }(12);
}

In substitution of 'template<class auto:1> main()::<lambda(auto:1)> [with
auto:1 = int]':
3:62:   required from here
3:35: internal compiler error: trying to capture 'f' in instantiation of
generic lambda
    3 |     return [&](auto i) requires (f(sizeof(i))) { return 99; }(12);
      |                                 ~~^~~~~~~~~~~~
0x1d00959 internal_error(char const*, ...)
0x800866 add_capture(tree_node*, tree_node*, tree_node*, bool, bool)
0x800bfa add_default_capture(tree_node*, tree_node*, tree_node*)
0x73fdda constraints_satisfied_p(tree_node*, tree_node*)
0x955913 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
0x6e2ace build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
0x981ab5 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
0x8e224d c_parse_file()
0xa612e2 c_common_parse_file()

Without the default-capture the program is rejected with

    note: constraints not satisfied
    [...]
    error: 'f' is not captured

which I think is incorrect since `f` is not odr-used; clang and MSVC accept
either way.

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

* [Bug c++/99994] internal compiler error: trying to capture 'f' in instantiation of generic lambda within constraints_satisfied_p
  2021-04-09 12:44 [Bug c++/99994] New: internal compiler error: trying to capture 'f' in instantiation of generic lambda within constraints_satisfied_p ed at catmur dot uk
@ 2021-04-13  2:55 ` cvs-commit at gcc dot gnu.org
  2021-04-13  2:57 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-13  2:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:59d9aa6d2efe7c52b6a986eb3e1977c1fb3c5753

commit r11-8144-g59d9aa6d2efe7c52b6a986eb3e1977c1fb3c5753
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Apr 12 22:54:55 2021 -0400

    c++: constraints are unevaluated operands [PR99961]

    According to [temp.concept]/6 and [temp.pre]/9, a concept definition and
    a requires clause are both unevaluated contexts, and hence satisfaction
    deals only with unevaluated operands, so we should set cp_unevaluated in
    these three situations.

    gcc/cp/ChangeLog:

            PR c++/99961
            PR c++/99994
            * constraint.cc (satisfy_normalized_constraints): Set
            cp_unevaluated.
            * parser.c (cp_parser_concept_definition): Likewise.
            (cp_parser_requires_clause_opt): Likewise.

    gcc/testsuite/ChangeLog:

            PR c++/99961
            PR c++/99994
            * g++.dg/cpp2a/concepts-uneval1.C: New test.
            * g++.dg/cpp2a/concepts-uneval2.C: New test.

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

* [Bug c++/99994] internal compiler error: trying to capture 'f' in instantiation of generic lambda within constraints_satisfied_p
  2021-04-09 12:44 [Bug c++/99994] New: internal compiler error: trying to capture 'f' in instantiation of generic lambda within constraints_satisfied_p ed at catmur dot uk
  2021-04-13  2:55 ` [Bug c++/99994] " cvs-commit at gcc dot gnu.org
@ 2021-04-13  2:57 ` ppalka at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-13  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |ppalka at gcc dot gnu.org
   Target Milestone|---                         |11.0
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11, thanks for the bug report.

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

end of thread, other threads:[~2021-04-13  2:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 12:44 [Bug c++/99994] New: internal compiler error: trying to capture 'f' in instantiation of generic lambda within constraints_satisfied_p ed at catmur dot uk
2021-04-13  2:55 ` [Bug c++/99994] " cvs-commit at gcc dot gnu.org
2021-04-13  2:57 ` ppalka 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).