[PATCH] D94646: [clang][MSVC] Fix missing MSInheritanceAttr in template specialization.
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 14 09:59:33 PST 2021
rnk added a comment.
Thanks, this seems like the right spot.
================
Comment at: clang/lib/Sema/SemaTemplate.cpp:9767
+ if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+ Def->hasAttr<MSInheritanceAttr>()) {
----------------
Let's remove this condition. There will only ever be inheritance attributes when the MS ABI is in use. I think fewer conditions is usually better.
================
Comment at: clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp:151-159
+namespace pr48687 {
+template <typename T> struct A {
+ T value;
+ static constexpr auto address = &A<T>::value;
+};
+extern template class A<float>;
+template class A<float>;
----------------
zequanwu wrote:
> zequanwu wrote:
> > I tried to put the following CHECK for this, it never works no matter where I put namespace pr48687 nor changing `CHECK` to `CHECK-DAG` works.
> > `// CHECK: @"?address@?$A at M@pr48687@@2QQ12 at MQ12@" = weak_odr dso_local constant i32 0, comdat, align 1`
> >
> > So, as long as it does not crash/error, it might be fine.
> >
> NVM, the align should be 4.
I see you sorted this out, thanks. I was going to suggest moving it earlier. Clang produces globals in a bit of an odd order.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94646/new/
https://reviews.llvm.org/D94646
More information about the cfe-commits
mailing list