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

    <tr>
        <th>Summary</th>
        <td>
            clang: Wrong handling of inline vs. overloadable attribute
        </td>
    </tr>

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

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

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

<pre>
    A function declared both inline and overloadable appears to not actually be overloadable. An example can be seen here:
[Godbolt](https://godbolt.org/z/MbnGPvPfv)

The first function declaration stems from GNU libc's syslog.h:

```
extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) __attribute__((__overloadable__)) void
vsyslog (int __pri, const char * const __attribute__ ((__pass_dynamic_object_size__ (1))) __fmt,
  __gnuc_va_list __ap)
{ ... }
```
as retrieved via clang -E. Trying to overload this with e.g.
```
void vsyslog (int priority, const char * __format, va_list ap) {
 printf ("<%d> ", priority);
    vprintf (__format, ap);
}
```
causes the first function being inlined, rather than calling the second, as can be observed in godbolts's compiler out line 54. gcc behaves the other way round, calling the overloading function instead.

The use case is e.g. in mock code for unit testing where one would rather intercept the output than have it go to actual syslog.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVMGOozgQ_RrnUhoEJiThwIHunsxpV3OY1R6RsQvwrrGRXdCT-fqVgUz3ZnqllSIFy8_l955flQhB9xaxYsUTK14OYqbB-UoOPshh1IoOrVO3qoZutpK0s6BQGuFRQetoAG2NtgjCKnALeuOEEq1BENOEwgcgB9YRCEmzMOYGLf4Ll0BtAb-LcTIIUti4HxAtDOiR5TVLa1Y8fXGqdYZY8cL4ZSCaQtziV8av_baVON8zfv3B-PW31n75unztFsbLeDytvw0InfaBHkWI9TsQjgE670b48vsfYHQrGT8HCLdgXJ8MO420Zqd0_6U1fif0FppmN6BpBJHX7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