[PATCH] D94646: [clang][MSVC] Fix missing MSInheritanceAttr in template specialization.
Zequan Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 13 19:15:03 PST 2021
zequanwu created this revision.
zequanwu added a reviewer: rnk.
zequanwu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Fix PR48687.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94646
Files:
clang/lib/Sema/SemaTemplate.cpp
clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
Index: clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
===================================================================
--- clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
+++ clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
@@ -148,6 +148,15 @@
// CHECK-SAME: %"struct.pr43803::C" { { i32, i32, i32 } { i32 8, i32 0, i32 0 }, [4 x i8] undef }]
}
+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>;
+}
+
struct PR26313_Y;
typedef void (PR26313_Y::*PR26313_FUNC)();
struct PR26313_X {
Index: clang/lib/Sema/SemaTemplate.cpp
===================================================================
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -9764,6 +9764,12 @@
dllExportImportClassTemplateSpecialization(*this, Def);
}
+ if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+ Def->hasAttr<MSInheritanceAttr>()) {
+ Specialization->addAttr(Def->getAttr<MSInheritanceAttr>());
+ Consumer.AssignInheritanceModel(Specialization);
+ }
+
// Set the template specialization kind. Make sure it is set before
// instantiating the members which will trigger ASTConsumer callbacks.
Specialization->setTemplateSpecializationKind(TSK);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94646.316552.patch
Type: text/x-patch
Size: 1365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210114/cc26ffe5/attachment.bin>
More information about the cfe-commits
mailing list