[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
Mon May 13 09:22:17 PDT 2024


MitalAshok wrote:

Example of the incompatibility: https://godbolt.org/z/Mn1T57WGb

```c++
struct unspecified_inheritance;
template<int I>
struct X {
    static_assert(I == sizeof(int unspecified_inheritance::*), "");
};

struct Y : X<sizeof(int Y::*)> {};
```

Currently, the `sizeof(int Y::*)` locks down the inheritance model of `Y` as single, when MSVC marks it as unspecified.

It was the intent that it should have been unspecified:

https://github.com/llvm/llvm-project/blob/89a080cb79972abae240c226090af9a3094e2269/clang/lib/AST/MicrosoftCXXABI.cpp#L223-L224

But `isParsingBaseSpecifiers()` was set after parsing instead of before.

https://github.com/llvm/llvm-project/pull/91990


More information about the cfe-commits mailing list