<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/114245>114245</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang][regression] constraint not satisfied when invoking non type template argument lambda
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          wanghan02
      </td>
    </tr>
</table>

<pre>
    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();
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU-P4rgT_TTFpdRRKBMIhxwgNJeffqce7bXlxE7wrGPTtgPT8-lXTkKA3tGuVqtttUIcl1_Ve_XH3HvVGikLyPaQHRa8Dyfriis37YmblBaVFZ_F6w_enbXE2or46LXASmJjexNftL2idWgNQrZvraisDpAdgPJTCGcPbAd0BDpOW4l1LdDxJ9Dxf9-bj5r_eP0A2iZYa25aXK6RG4GaB-nwIp1X1nisbXfWXBkMJx6wtsYHx5UJHm2De-5l9MJ2FXeoPBob0POgfKOkmIEzoBLbuh7w___2W4lc6wFZaYmNMjKB9ADpbnqu0-l_XBJT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