Open
Description
Code
struct a { int j; };
template<int a::* i> void g_() { }
void bar() {
g_< (int a::*)0 >();
}
Additional options required: -target x86_64-windows -std=c++17
godbolt demo https://godbolt.org/z/GcMGcW4PE
Seems like clang 21 regression.
Triage notes:
- The assertion message is:
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/MicrosoftCXXABI.cpp:234: clang::MSInheritanceModel clang::CXXRecordDecl::getMSInheritanceModel() const: Assertion `IA && "Expected MSInheritanceAttr on the CXXRecordDecl!"' failed.
Seems MSInheritanceAttr
is missing.
- The attribute is added in
assignInheritanceModel
function defined in SemaType.cpp if the sample is compiled in C++14 mode. We never enter it when compiling in C++17 mode. The codepath toassignInheritanceModel
leads throughSema::CheckTemplateArgument
and thenCheckTemplateArgumentPointerToMember
. In C++17 mode we exit fromSema::CheckTemplateArgument
earlier and never callassignInheritanceModel