Apple clang's strange behavior: alignof(T) with T=__m512 is not equal to alignof(__m512)

Edit: It seems that this forums's markdown render have problem on rendering this post. You can review the origin post on StackOverflow.

I ran into a strange situation that alignof(m512) is not equal to std::alignment_of<m512>::value compiled by Apple's clang. After some testing I found that when alignof(T) is evaluated inside a template with T=m512, the result is different with direct alignof(m512).
I also ran several test compiled by g++ and non-Apple's clang on ubuntu(WSL) and got correct(I thought) behavior.
Is this a bug of Apple's clang?

Code Block c
#include <immintrin.h> //avx headers
#include <cstdio>
#include <typeinfo>
#include <type_traits>
void test_directly() {
printf("directly: typeid %s alignof %zu\n", typeid(m512).name(), alignof(m512));
}
template<typename T>
void test_as_template_argument() {
static_assert(std::is_same<T, m512>::value, "assert");
printf("template: typeid %s alignof %zu\n", typeid(T).name(), alignof(T));
}
int main() {
test_directly();
test_as_template_argument<__m512>();
return 0;
}



output(compiled with clang -std=c17 -march=native):
Code Block
directly: typeid Dv16_f alignof 64
template: typeid Dv16_f alignof 32


clang's version:
Code Block
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


macOS's version: macOS Catalina 10.15.4 (19E2269) Darwin 19.4.0

Is this a bug of Apple's clang?

File one and see what comes back.

No joy, burn a support ticket w/DTS and have a demo project they can examine and feedback on.
@KMT Do you know where I can report the issue to Apple's clang? I had done some searching but only found this forum.
Apple clang's strange behavior: alignof(T) with T=__m512 is not equal to alignof(__m512)
 
 
Q