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

    <tr>
        <th>Summary</th>
        <td>
            A parameter pack appears both empty and non-empty at the same time
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Found a really concerning bug:
```cpp
template <typename ...P>
struct A {};

struct B
{
 consteval B() {} // Making this constexpr makes the assert below pass.

 template <typename ...P>
    consteval operator A<P...>() const
    {
 static_assert(sizeof...(P) > 0); // This fails on Clang.
        return {};
    }
};

template <typename T>
struct type_identity 
{
    using type = T;
};

template <typename ...P>
void foo(typename type_identity<A<P...>>::type a, P...) {}

int main()
{
    foo(B(), 1, 2);
}
```
The `static_assert` fires on Clang, meaning it calls `operator A<>` with no template arguments! But the corresponding function parameter is `A<int, int>`.

Apparently `A<>` gets reinterpreted (!!) into `A<int, int>` at compile-time. E.g. if you add a `int x = sizeof...(P)` data member to it, it'll be `0` despite the type actually being `A<int, int>`.

Here's an example of this being used to `reinterpret_cast` a `float` into an `int`: https://gcc.godbolt.org/z/Txbsj8ofM
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVE9v4y4Q_TTkMqrl4PxxDj446UZ7WamH3qsxniRsMSAYt81--p_A3qZZ_f5ZyBaGeW_mzQOMUZ8tUSPWe7F-XODIFxea785c9wbV6wF50bn-2hzdaHtACITGXEE5qyhYbc_QjWdRtaJsxaachvJelC3T4A0ygagOfPVkcSAoiuJJVN9E2UYOo2JoQWz3Yvsoqn2C-PyfZ9v0TlyR6Q0N7IWshdzNISDkUcgj_MDXlAdfdJz3fvgAA75SBL4QYIwUGDoy7h08xlhMTPAfGQLAF27nKSC7AK2oDk9FUaRNUzp50xww5xwZWauXiVrIOupf5E4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