Description
When -std=c++20
is specified, clang fails to build a simple program that instantiates a varadic template due to an assertion. Compiling the same program with -std=c++17
works as expected.
Code:
struct base {
int k{2};
};
struct A : virtual public base {
};
struct B : virtual public base {
};
template<typename...args>
struct X : public args... {
using args::k ...;
};
void t(void) {
X<A, B> x;
x.A::k=1;
return;
}
Output:
$ clang++ --version |& grep version
clang version 18.0.0 (git@github.com:llvm/llvm-project.git abacab6e0c30ff0f6327e7b4fbc044af0a195efe)
$ clang++ -c -std=c++20 test.cpp
clang++: /home/mvoss/llvm-project/llvm/include/llvm/ADT/SmallVector.h:298: llvm::SmallVectorTemplateCommon::const_reference llvm::SmallVectorTemplateCommon<clang::APValue::LValuePathEntry>::operator[](llvm::SmallVectorTemplateCommon::size_type) const [T = clang::APValue::LValuePathEntry]: Assertion `idx < size()' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/mvoss/llvm-project/build/bin/clang++ -c -std=c++20 test.cpp
1. test.cpp:24:5: current parser token 'return'
2. test.cpp:20:20: parsing function body 't'
3. test.cpp:20:20: in compound statement ('{}')
...
$ clang++ -c -std=c++17 test.cpp
$
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done