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

    <tr>
        <th>Summary</th>
        <td>
            clang claims weak aliases are not supported on Darwin but only when using __attribute__, works fine with #pragma
        </td>
    </tr>

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

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

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

<pre>
    clang claims weak aliases are not supported on Darwin. The following code doesn't compile:

```
#include <stdio.h>

int func1( ) { return 42; }
__attribute__((weak, alias("func1")))  int func2( );

int main( )
{
        printf("%d\n", func2());
        return 0;
}
```

Output:
```
test1.c:4:22: error: aliases are not supported on darwin
__attribute__((weak, alias("func1")))  int func2( );
                     ^
1 error generated.
```

But that's not true. Weak aliases are supported on Darwin. The following code will compile and will behave correctly:

```
#include <stdio.h>

int func1( ) { return 42; }

#pragma weak func2 = func1
int func2( );

int main( )
{
        printf("%d\n", func2());
        return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVMuO6zYM_Rp6Q4xhS3GcLLzIo9kV3RToMpBtxlZHkQyJmmD-vvAjSScoBkWBXtxAUGSJOuQhj6hC0J0lqqDYQ3FMVOTe-ergWm27X5V_jyGpXftZNUbZDhuj9DXgjdQ7KqNVoIDKE1rHGOIwOM_UorN4VP6mbYq_94QXZ4y76fG6awlbR8GCKBkbdx20IZA7yI6Q3ed1toz5U0htGxNbQpCHwK12aQ_yl79f0ZbxEm2Tg9ggiC1CuUdPHL3FlQC5RyiPs-n5rJi9riPT-QxiA2IzsgFxmAlNW2IBEyC280C8-xCLD5D71xCuStv76XxUPmy2g9eWLzM8iKKF4mCn5eEBu3h7Am8XDtlz787jNUvT_FvkIfIzn19tmALnaQNytwK5EwLkDsl758fFt9Vsp2r-XwnEf_pBsVQ4n2PEjix5xdSm3yRgHxm5VwyiDBMN9pFS_ONVr_9WqzdtzF2mqGw7b9TUqw_CxnlPDZvPHyrgB-jgVXdV81uc8oogjwvKF9CfTbFJW8l2K7cqoSpfbzebTVaUZdJXBTW0qjMqpWxrpS4io1w1a5L5qm3Eukx0JTIh8zzLhczX-Tpdk1BKlplSWdlsiGCV0VVpkxrzcU2d7xIdQqSqzLMsT4yqyYSp1QkxNbSRTnFMfDXav9WxC7DKjA4cngis2dB_639YR0ZnzSfeerIYwyislwd0wJvz7wEv2o564x4ftU2iN1XPPIRRYeIE4tRp7mOdNu4K4jSGuPy9Dd79SQ2DOE2MA4jTRPqvAAAA__9knLZa">