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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Availability attribute only triggers on the second use of a variable
        </td>
    </tr>

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

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

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

<pre>
    ```
cat <<EOF | clang++ -xc++ - -fsyntax-only
template <class _ValueType = int>
class __attribute__((unavailable)) polymorphic_allocator { };

void f() {
    polymorphic_allocator<void> a;
 polymorphic_allocator<void> b;
}
EOF
```

This fails with:

```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEUk-Poz4M_TTmYrUiCX8PHNpSrnMZ_a6VAwHyU0pQErrDt19ROjO7q5VWQsZy3nuW7Ufe62FSqoL0DGkd0RJG6yrTaTtNKpK2WyvI4tcX1xCfWgoI4gLicn1rEPILtoamAfgZ-BkPH-1nhofer1Ogj4OdzLqTg7rPhoLaFFpD3uPtPzKLel_nrVajngKI66vTDrhRCE7LJajbDXgBvFgmepA2JI0CXgIvcbZmvVs3j7q9kTG2pWAdQn5GyGsQ511wjw-rO-yfSuUG2auI-HcVEJeNAeKK9KX0T6j8bprXe3J9a16V3xe6x_dRe-xJG48_dBhBnH59_YMSdZXoSlFSpCqWFTHjCc_TaKy4VB1LVCFELMs-4znvuoJKGQumEpmwSFc85iIWvOSMMZYe20RR1lOhMpbKoheQxOpO2hyNedyP1g2R9n5RVcYKlkaGpDL-0y2u2kAHuQwekthoH_w3Lehgnr7a7ZHWeNqPpo0OK34dFTd3YHB6GJTzaCcMo0KvWjt1uHiFtkfCBzm93TtanKnGEGa_bYg3wJtBh3GRx9begTdb-9fvMDv7v2oD8OY5ggfePKf4GQAA__-OOuXe">