Issue 114245
Summary [clang][regression] constraint not satisfied when invoking non type template argument lambda
Labels clang
Assignees
Reporter wanghan02
    Example code could be found below or on [godbolt](https://godbolt.org/z/KjfqcaxEq). clang 16 and later versions complain that constraints of Base::bar is not satisfied. clang 15, gcc and MSVC all compile fine.

```
#include <utility>

struct S {
    void baz(auto) const& {}
};

template<typename T>
struct Base {
    T m_t;
 int m_n;

    template<auto mem_fn, typename... Args>
    void bar(Args&&... args) & requires requires { // clang 16 and later versions: candidate template ignored: constraints not satisfied
        mem_fn(m_t, m_n, std::forward<Args>(args)...);
    } {
        mem_fn(m_t, m_n, std::forward<Args>(args)...);
    }
};

template<typename T>
struct Derived: Base<T> {
    void foo() & {
        [&](auto) { // problem goes away if auto -> int
            this->template bar<[](auto& t, auto&&... args) {
 t.baz(std::forward<decltype(args)>(args)...);
            }>();
 }(3);
    }
};

void test(Derived<S>& d) {
 d.foo();
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to