Extended Description
When compiling Clang with assertions enabled, I'm seeing the assert I've mentioned here: https://reviews.llvm.org/D71547#1824272
Repro:
// a.cpp
// Build with: clang-cl a.cpp /c /O1
#include
struct SP {
void WeakAddRef();
void WeakRelease();
};
template struct PtrBase {
T *volatile P;
~PtrBase() {
if (R)
R->WeakRelease();
}
PtrBase(const PtrBase &O) : R(O.R) {
if (R)
R->WeakAddRef();
}
SP *R;
bool IsValid() const { return P != nullptr; }
};
struct alignas(16) VectorSIMD4f {
float V;
};
unsigned __int64 countAF() {
class AF {
VectorSIMD4f B;
};
struct PD {
PtrBase P;
};
std::vector AFs;
unsigned __int64 C = 0;
for (auto A : AFs) {
if (A.P.IsValid())
++C;
}
return C;
}