[clang] [Clang] Fix Microsoft ABI inheritance model when member pointer is used in a base specifier (PR #91990)
Mital Ashok via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 6 12:59:22 PDT 2024
================
@@ -215,6 +215,14 @@ struct NewUnspecified;
SingleTemplate<void (IncSingle::*)()> tmpl_single;
UnspecTemplate<void (NewUnspecified::*)()> tmpl_unspec;
+// Member pointers used in base specifiers force an unspecified inheritance model
+struct MemPtrInBase : UnspecTemplate<void (MemPtrInBase::*)()> {};
----------------
MitalAshok wrote:
I see what you mean.
If there were two bases `struct MemPtrInBase : UnspecTemplate<void (MemPtrInBase::*)()>, SomeOtherClass {`, `UnspecTemplate<void (MemPtrInBase::*)()>` would be instantiated and completed before the token for `SomeOtherClass` is seen. So this is the case for Clang, but I don't see why a different compiler couldn't parse all the bases at once then instantiated them.
However, they need to be instantiated at least before the body of the struct is parsed (because the bases affect name lookup), and this is essentially the same time as when you are "parsing the base specifiers".
And of course it needs to match Microsoft behaviour and assign the unspecified inheritance model during this time.
https://github.com/llvm/llvm-project/pull/91990
More information about the cfe-commits
mailing list