<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62543>62543</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
There is an issue with alignof in the template
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
4465464
</td>
</tr>
</table>
<pre>
#include <iostream>
__attribute__((aligned(8))) typedef struct{
int x;
int y;
} int2;
template<class T>
void test(){
int a =alignof(T);
printf("a:%d\n",a);
}
int main(){
test<int2>();
return 0;
}
The result of alignof (int2) in the template and not in the template is inconsistent. The expected result should be 8, but in reality it is 4.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0ks1uqzAQhZ9m2IwawZjfBYs2aZ4g-8jgSfCVYyJ7aJu3v8LpT9SrKyEjHXu-czhYx2jPnrmH6gWqXaYXmebQl2VdlXWZDbO59UDK-tEthhHU1s5RAusLqFfId5A_39fjUYsEOyzCxyNQC9Rqt6INUNsCdfcHUW5XNnzCKGEZBZqX-zwiovWCH6B-KbdvBZrdqtCPkFbhy9VpYVDb0ekY8fCd7W22BoWjpETdj9sK1ghql0LOJ6D2sB54NL8G6-WUJkmDegaqDFRbD0RAW_14HJrdY6KVftHW_3ZNSdT2_g2vn7uPloFlCR7z_4EPE2PguDjB-YSf2RGoTUjq0HqUifGrEtTeoJ_lH91GtH6cfbRR2MsGVzJ_XHkUNl8WcZoXZ3BgbIG2OCyJE1g7Kze0slLKDWamV6ZTnc64L-pWFW1dUJtNPZWmMXk7FmOnWFfFOHBTn8xY5AObbmgz21NOKq_yMm9KyttN09WNOpmiU4XS3VBBmfNFW7dx7u2ymcM5szEu3NdUlSpzemAX09Ul8vyOaXP9PdUuC_068zQs5whl7myU-EMRK477w8QhVaH9fRTfrUzftf7qLFuC6yeRa0x3YQ-0P1uZlmEzzheg_Qr_fD1dw_yHRwHaJ24E2qfIfwMAAP__qaMGNg">