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

            Bug ID: 93698
           Summary: ICE on concept using generic lambda
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kretz at kde dot org
  Target Milestone: ---

Test case (-std=c++2a):

  template <int N> concept foo = [](auto) constexpr -> bool { return true;
}(N);
  bool a = foo<2>;

Extended test case (use lambda in concept to turn integer into index sequence):

  #include <utility>
  template <int N>
  concept foo = []<std::size_t... Is>(std::index_sequence<Is...>) constexpr {
    return (Is + ...) > 10;
  }(std::make_index_sequence<N>());
  bool a = foo<7>;

If I read the standard correctly, both test cases are well-formed and should
work: P0315R4 started to allow lambdas in unevaluated contexts
(https://eel.is/c++draft/temp.concept#6).

On a slight tangent: I believe substitution failures on instantiation of the
lambda are not ill-formed, even though P0315R4 seemed to intend that outcome.
While I would love to use it to SFINAE test structured bindings, I think this
is rather a defect in the current WD, no?

Reply via email to