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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Bogus error about converting pointer to void* when using `void*` constant parameter/NTTP and a generic lambda
        </td>
    </tr>

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

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

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

<pre>
    Compiled with `-std=c++20 -fsyntax-only` <https://godbolt.org/z/f8roYGY5b>:

```c++
extern int x;

template<void* p>
constexpr void f() {
    []<typename = void>() {
 static_assert(p == &x);
    }();
}

int main() {
 f<(void*)&x>();
}
```

```
<source>:6:23: error: conversion from 'int *' to 'void *' is not allowed in a converted constant expression
    6 | static_assert(p == &x);
      |                       ^
<source>:5:5: note: in instantiation of function template specialization 'f()::(anonymous class)::operator()<void>' requested here
    5 |     []<typename = void>() {
      |     ^
<source>:11:5: note: in instantiation of function template specialization 'f<&x>' requested here
   11 |     f<(void*)&x>();
      | ^
<source>:3:16: note: template parameter is declared here
    3 | template<void* p>
      |                ^
```

Removing the `<typename = void>` (i.e., making it a non-generic lambda) makes this compile.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVUGPozgT_TWVSykRlAMkBw7pZPKdvtVqNZc5rRwogreNzdomncyvXxlIejPbLe1I26KFhaser54fL9J7dTbMJWQvkB0WcgitdeX_VZB651v7ujjZ-lbubdcrzTW-qdAi5MnShxrEoQJ6AXqhBJeNv5kgr0tr9A3yBEHs2xB6D2IHdAQ6nm19sjqsrDsDHb8DHZuNs9_-9y07gfgSy5LxypPpmrEh2fE1sDOoTMAriJepLnDXaxkYxP5iVQ20wz7iJLvKGh_42juMG9gAbYC2CEXsREScZgWxD7eejewYQRzG4gjwVO2DDKr6XXrPLgBt-lgaq4HyK9B2ojOCFoepdWZYHC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