Issue 144081
Summary [clang] Crash in release mode and assertion fail in build with asserts when compiling for Windows with -std=c++17
Labels clang:frontend, regression
Assignees
Reporter Fznamznon
    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:

1. 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.

2. 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 to `assignInheritanceModel` leads though `Sema::CheckTemplateArgument` and then `CheckTemplateArgumentPointerToMember`. In C++17 mode we exit from `Sema::CheckTemplateArgument` earlier and never call `assignInheritanceModel`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to