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

    <tr>
        <th>Summary</th>
        <td>
            `__attribute__((availability))` does not suppress availability warnings in template functions
        </td>
    </tr>

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

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

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

<pre>
    Consider this program:

```
C:\src\llvm-project>type foo.mm
#define A __attribute__((availability(macosx,introduced=10.13,deprecated=10.14)))

void f0() A;

A void f1() {
  f0();
}

template<class T>
A void f2() {
  f0();
}
```

`f1()` and `f2()` are identical, except that `f2()` is a template.

`f0()` only exists on macOS 10.13+, but `f1()` and `f2()` do too (since they both also have the attribute), so the call to `f0()` shouldn't warn. But it does warn in `f2()`:

```
C:\src\llvm-project>out\gn\bin\clang.exe --target=x86_64-apple-macosx -c foo.mm -mmacosx-version-min=10.11
foo.mm:11:3: warning: 'f0' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
  f0();
  ^~
foo.mm:3:6: note: 'f0' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.11.0
void f0() A;
     ^
foo.mm:11:3: note: enclose 'f0' in an @available check to silence this warning
  f0();
  ^~
1 warning generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVEGv4jgM_jXlYrUqKaWPQw88eHOdw660R5Qmps1MmlRJyjz-_TqlQAdpdnYXhTSx4_iz_TmNldf6YI1XEh2ETnkYnG0d75Nin-THJL_P23we0_YQ1eXBO0Gz1pc-JbNvKEJSfITrgHC2Nuv72ZYVEs_KIOzhdOIhONWMAU-nhL3R4BeuNG-UVuFK254L6z8TdlAmOCtHgTIpjus8WxcklDg4FDw8hJuE7eaxgHuxSsI5nxzsYJ8U70vtHm769axPqlkND5unRXVcmgbsB03uk-IgNPce_qSI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