Closed
Description
Test case extracted from qtwebengine 6.7.0-beta2:
$ clang++ -std=c++20 testcase.cpp
clang-18: /home/bero/abf/llvm/BUILD/llvm-project-release-18.x/build/tools/clang/include/clang/AST/TypeNodes.inc:36: TypeInfo clang::ASTContext::getTypeInfoImpl(const Type *) const: Assertion `!T->isDependentType() && "should not see dependent types here"' 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: /usr/bin/clang-18 -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name testcase.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/tmp -fcoverage-compilation-dir=/tmp -resource-dir /usr/lib64/clang/18 -internal-isystem /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/13.2.1/../../../../include/c++/13.2.1 -internal-isystem /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/13.2.1/../../../../include/c++/13.2.1/x86_64-openmandriva-linux-gnu -internal-isystem /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/13.2.1/../../../../include/c++/13.2.1/backward -internal-isystem /usr/lib64/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/13.2.1/../../../../x86_64-openmandriva-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++20 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=13.1.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/testcase-1cf133.o -x c++ testcase.cpp
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. testcase.cpp:6:6: Generating code for declaration 'construct_at'
#0 0x00007f0d0238e916 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib64/libLLVM-18.so+0x458e916)
#1 0x00007f0d0238d58a llvm::sys::RunSignalHandlers() (/usr/lib64/libLLVM-18.so+0x458d58a)
#2 0x00007f0d0238e234 (/usr/lib64/libLLVM-18.so+0x458e234)
#3 0x00007f0cfd855700 (/usr/lib64/libc.so.6+0x3d700)
#4 0x00007f0cfd8a49cc (/usr/lib64/libc.so.6+0x8c9cc)
#5 0x00007f0cfd855652 gsignal (/usr/lib64/libc.so.6+0x3d652)
#6 0x00007f0cfd83e4ad abort (/usr/lib64/libc.so.6+0x264ad)
#7 0x00007f0cfd83e3d5 (/usr/lib64/libc.so.6+0x263d5)
#8 0x00007f0cfd84e042 (/usr/lib64/libc.so.6+0x36042)
#9 0x00007f0d093767ce clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/usr/lib64/libclang-cpp.so.18+0x19767ce)
#10 0x00007f0d09376f31 clang::ASTContext::getTypeInfo(clang::Type const*) const (/usr/lib64/libclang-cpp.so.18+0x1976f31)
#11 0x00007f0d0a9e4f42 clang::CodeGen::CodeGenFunction::CreateIRTemp(clang::QualType, llvm::Twine const&) (/usr/lib64/libclang-cpp.so.18+0x2fe4f42)
#12 0x00007f0d0ac29ffe clang::CodeGen::CodeGenFunction::StartFunction(clang::GlobalDecl, clang::QualType, llvm::Function*, clang::CodeGen::CGFunctionInfo const&, clang::CodeGen::FunctionArgList const&, clang::SourceLocation, clang::SourceLocation) (/usr/lib64/libclang-cpp.so.18+0x3229ffe)
#13 0x00007f0d0ac2cc99 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/lib64/libclang-cpp.so.18+0x322cc99)
#14 0x00007f0d0ac770fe clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib64/libclang-cpp.so.18+0x32770fe)
#15 0x00007f0d0ac764ca clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib64/libclang-cpp.so.18+0x32764ca)
#16 0x00007f0d0ac4483f clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib64/libclang-cpp.so.18+0x324483f)
#17 0x00007f0d0ac4486b clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib64/libclang-cpp.so.18+0x324486b)
#18 0x00007f0d0ac4486b clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib64/libclang-cpp.so.18+0x324486b)
#19 0x00007f0d0ac417ab clang::CodeGen::CodeGenModule::Release() (/usr/lib64/libclang-cpp.so.18+0x32417ab)
#20 0x00007f0d0ad0b364 (/usr/lib64/libclang-cpp.so.18+0x330b364)
#21 0x00007f0d0ac18830 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib64/libclang-cpp.so.18+0x3218830)
#22 0x00007f0d09245416 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib64/libclang-cpp.so.18+0x1845416)
#23 0x00007f0d0b77d34b clang::FrontendAction::Execute() (/usr/lib64/libclang-cpp.so.18+0x3d7d34b)
#24 0x00007f0d0b6e1799 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib64/libclang-cpp.so.18+0x3ce1799)
#25 0x00007f0d0b7fc71a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib64/libclang-cpp.so.18+0x3dfc71a)
#26 0x0000560e96d84096 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-18+0x17096)
#27 0x0000560e96d7fd4f (/usr/bin/clang-18+0x12d4f)
#28 0x0000560e96d7e61b clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-18+0x1161b)
#29 0x0000560e96d8ef96 main (/usr/bin/clang-18+0x21f96)
#30 0x00007f0cfd83fc0a (/usr/lib64/libc.so.6+0x27c0a)
#31 0x00007f0cfd83fcc5 __libc_start_main (/usr/lib64/libc.so.6+0x27cc5)
#32 0x0000560e96d7bed1 _start (/usr/bin/clang-18+0xeed1)
Test case
struct BasicPersistent;
template <typename> BasicPersistent &&__declval(int);
template <typename _Tp> auto declval() -> decltype(__declval<_Tp>(0));
template <typename _Tp> _Tp forward;
template <typename _Tp, typename... _Args>
auto construct_at(_Tp *, _Args...) -> decltype(new _Tp(declval<_Args>()...)) {return 0;}
template <typename> struct allocator;
template <typename> struct allocator_traits;
template <typename _Tp> struct allocator_traits<allocator<_Tp>> {
using pointer = _Tp *;
template <typename _Up, typename... _Args>
static void construct(_Up __p, _Args...) {
construct_at(__p, forward<_Args>...);
}
};
struct __alloc_traits : allocator_traits<allocator<BasicPersistent>> {
} push_back___x;
__alloc_traits::pointer _M_impl_0;
template <typename... _Args> void emplace_back(_Args...) {
__alloc_traits::construct(_M_impl_0, forward<_Args>...);
}
struct SourceLocation {
static SourceLocation Current(const char * = __builtin_FUNCTION());
};
struct BasicPersistent {
BasicPersistent(BasicPersistent &&,
SourceLocation = SourceLocation::Current());
};
void CFXJSE_EngineAddObjectToUpArray() { emplace_back(push_back___x); }