<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/144642>144642</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang]Crashes when initializing an rvalue reference array of an incomplete class type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Rush10233
</td>
</tr>
</table>
<pre>
Generated by fuzzer that deletes the class declaration body to create incomplete classes.
Probably starts from clang-9: https://godbolt.org/z/6fE8nzsna
Simplified test:
```c++
class MoveOnly;
void foo() {
MoveOnly (&&mo)[1] = {};
}
```
$clang++ -fsyntax-only mut16.cpp
```
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-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <source>:5:28: current parser token ';'
2. <source>:4:14: parsing function body 'foo'
3. <source>:4:14: in compound statement ('{}')
#0 0x0000000003c1ff08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c1ff08)
#1 0x0000000003c1e04c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c1e04c)
#2 0x0000000003b6e6d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000074d51ea42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x0000000000c3f490 clang::Sema::LookupSpecialMember(clang::CXXRecordDecl*, clang::CXXSpecialMemberKind, bool, bool, bool, bool, bool) (.cold) SemaLookup.cpp:0:0
#5 0x00000000068d808a clang::Sema::LookupDestructor(clang::CXXRecordDecl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x68d808a)
#6 0x00000000068638bb checkDestructorReference(clang::QualType, clang::SourceLocation, clang::Sema&) SemaInit.cpp:0:0
#7 0x000000000687da58 (anonymous namespace)::InitListChecker::CheckArrayType(clang::InitializedEntity const&, clang::InitListExpr*, clang::QualType&, llvm::APSInt, bool, unsigned int&, clang::InitListExpr*, unsigned int&) SemaInit.cpp:0:0
#8 0x000000000687f4c2 (anonymous namespace)::InitListChecker::CheckListElementTypes(clang::InitializedEntity const&, clang::InitListExpr*, clang::QualType&, bool, unsigned int&, clang::InitListExpr*, unsigned int&, bool) (.constprop.0) SemaInit.cpp:0:0
#9 0x000000000687faaa (anonymous namespace)::InitListChecker::CheckExplicitInitList(clang::InitializedEntity const&, clang::InitListExpr*, clang::QualType&, clang::InitListExpr*, bool) (.constprop.0) SemaInit.cpp:0:0
#10 0x0000000006880317 (anonymous namespace)::InitListChecker::InitListChecker(clang::Sema&, clang::InitializedEntity const&, clang::InitListExpr*, clang::QualType&, bool, bool, bool, llvm::SmallVectorImpl<clang::QualType>*) SemaInit.cpp:0:0
#11 0x0000000006880625 diagnoseListInit(clang::Sema&, clang::InitializedEntity const&, clang::InitListExpr*) SemaInit.cpp:0:0
#12 0x0000000006880597 diagnoseListInit(clang::Sema&, clang::InitializedEntity const&, clang::InitListExpr*) SemaInit.cpp:0:0
#13 0x00000000068884d6 clang::InitializationSequence::Diagnose(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::ArrayRef<clang::Expr*>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x68884d6)
#14 0x0000000006880ff5 clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6880ff5)
#15 0x00000000065b65db clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x65b65db)
#16 0x000000000621099e clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x621099e)
#17 0x00000000062265fc clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62265fc)
#18 0x00000000062292fa clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62292fa)
#19 0x0000000006229827 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6229827)
#20 0x00000000062f6b46 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62f6b46)
#21 0x00000000062f747e clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62f747e)
#22 0x00000000062ff20d clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62ff20d)
#23 0x00000000062ffc4a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x62ffc4a)
#24 0x00000000061da536 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61da536)
#25 0x0000000006226a5f clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6226a5f)
#26 0x00000000061d28d7 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61d28d7)
#27 0x00000000061d36ee clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61d36ee)
#28 0x00000000061dd25f clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61dd25f)
#29 0x00000000061dead8 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61dead8)
#30 0x00000000061cceba clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61cceba)
#31 0x000000000456c23d clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x456c23d)
#32 0x000000000487dd3a clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x487dd3a)
#33 0x00000000047f997b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x47f997b)
#34 0x00000000049727c3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x49727c3)
#35 0x0000000000d97015 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd97015)
#36 0x0000000000d8efdd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#37 0x00000000045ddf39 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#38 0x0000000003b6eaf3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3b6eaf3)
#39 0x00000000045de159 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#40 0x00000000045a0e1d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45a0e1d)
#41 0x00000000045a1dd1 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45a1dd1)
#42 0x00000000045ac6bc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45ac6bc)
#43 0x0000000000d93911 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd93911)
#44 0x0000000000c4c1e4 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4c1e4)
#45 0x000074d51ea29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#46 0x000074d51ea29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#47 0x0000000000d8ea75 _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd8ea75)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsm91y27gVx5-GvsHIQ4LfF75gJHubbTJxo0xn7zwgAEqoSYALgI6Up-8AoEyRkmUnZdKdaXe8sUzi439-ODg4BCGkFNtwSm-8-J0Xr65Qp7dC3nzu1DbwYRhelYLsb36jnEqkKQHlHlTdt29UAr1FGhBaU00V0FsKcI2UAoTiGkmkmeDA1AVaACwp0hQwjkXTmgquLFXXnl94fnEvRYnKeg-URlIrUEnRmCJ8s8i9sABbrVvlhYUH7zx4txGkFLW-FnLjwbtvHrxLqtuMf1McuebWrGlrVjFKgKZKm4r2upf47gd78J358QvQq_4onugnXu-98J0rC8CTYARUQngw82AOvNSVB89lgb2TeDBphAdzL34XePEKeOHKFk5XrjFgPh113muBkTXQKQGLSu25RruFMA03nQ6Sa9y2k3r3H26L9S1QXdkwDRAouw2QtBVSG8oTSkxvu_Iai8aDd3X9dPi1aKX4F8Xag3dMqY4qD94BxIkZnboj1A2lRGoLSoQftUSYenAJWklbKTBVihKgRCfdZVMTKSUws-4hOw4UlqzVZmjXGuFHQLqmdWPgX3t-fi_FRqIGILnpGsq1kQw8eCdao8l4CKupXNBdWwtJpblmPUHLjj968K5k_HDtAG9DviJZLSKw2ICFMI2htjVNdrrt9LUCi8aYDhaLXZYskGoWjrYXrhjXtAaLiovFE5WlUNTcB4s1WCw2GC-0EDXeIsa9cHVRpCmsOGrVVmiwqLCohVwQhjZcKM2wcn1YsKPLXrjsaYa3nl8EBtHoWljEXljAzGDCnZSUa9AiqcwUFI-UAw-mxtNg6vkFPFM98sIiMP_YaoxvQNVxPExQD6bWzU398GJ9xoExXXScmKmqqRk_Nw3S3uVhaqa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