Closed
Description
Given:
void wrapper() {
constexpr auto f = []() constexpr {
return 0;
};
constexpr auto g = [f]() constexpr {
return f();
};
static_assert(g() == f());
}
With -fexperimental-new-constant-interpreter
clang crashes evaluating the declaration of g
:
clang++: /root/llvm-project/clang/include/clang/AST/APValue.h:553: clang::APValue& clang::APValue::getStructField(unsigned int): Assertion `i < getStructNumFields() && "field index OOB"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fexperimental-new-constant-interpreter <source>
...
(see: https://godbolt.org/z/nz8v5sffc )