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

            Bug ID: 92633
           Summary: [concepts] constrained lambda with placehoder syntax
                    getting wrong substitution
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric.niebler at gmail dot com
  Target Milestone: ---

The following code fails to compile with trunk with -std=c++2a

template<class A, class B>
concept different_than = !__is_same_as(A, B);

template<class B>
auto diff(B) {
    return [](different_than<B> auto a) {};
}

int main() {
    diff(42)("");
}


By the time the compiler evaluates the constraint, it seems to have forgotten
the context in which the constraint lives; that is, it no longer seems to know
what type B is.

I think the code should compile, and it does with clang-concepts:
https://godbolt.org/z/3QzhxS

Reply via email to