Closed
Description
I migrated my project from llvm12.0 to llvm15.0 and found a problem. It worked fine in version 12.0, but in version 15.0 it got an assertion failure.
This is a reproduct code snippet:
BitVector bv;
auto d = bv.getData();
std::cout << d.size() << std::endl;
I expect it to work. But got:
llvm-project/llvm/include/llvm/ADT/SmallVector.h:298: const T& llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::operator[](llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type) const [with T = long unsigned int; <template-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::const_reference = const long unsigned int&; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type = long unsigned int]: Assertion `idx < size()' failed.
This problem still occurs in recent versions of llvm. I'm not sure it's a reasonable behavior for an empty BitVector.