<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132773>132773</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Assertion `(data().DefaultedCopyConstructorIsDeleted || needsOverloadResolutionForCopyConstructor()) && "Copy constructor should not be deleted"` failed
</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>
Goes back to clang-6: https://godbolt.org/z/s1d9ze1xq
Generated by fuzzer trying to add class members.
Seed program: https://github.com/llvm/llvm-project/blob/main/clang/test/SemaCXX/copy-constructor-error.cpp
Stack Dump:
```c++
clang++: /root/llvm-project/clang/include/clang/AST/DeclCXX.h:871: void clang::CXXRecordDecl::setImplicitCopyConstructorIsDeleted(): Assertion `(data().DefaultedCopyConstructorIsDeleted || needsOverloadResolutionForCopyConstructor()) && "Copy constructor should not be deleted"' 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 -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <source>:54:27: current parser token ','
2. <source>:35:1: parsing namespace 'PR10618'
3. <source>:51:3: parsing struct/union/class body 'PR10618::C'
#0 0x0000000003e95b68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e95b68)
#1 0x0000000003e937f4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e937f4)
#2 0x0000000003dd8688 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000075afca442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000075afca4969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000075afca442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000075afca4287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000075afca42871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000075afca439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000006936515 clang::Sema::DeclareImplicitCopyConstructor(clang::CXXRecordDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6936515)
#10 0x0000000006bd8780 clang::Sema::ForceDeclarationOfImplicitMembers(clang::CXXRecordDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6bd8780)
#11 0x0000000006c006bc (anonymous namespace)::LookupVisibleHelper::lookupInDeclContext(clang::DeclContext*, clang::LookupResult&, bool, bool) SemaLookup.cpp:0:0
#12 0x0000000006c03a5a clang::Sema::LookupVisibleDecls(clang::DeclContext*, clang::Sema::LookupNameKind, clang::VisibleDeclConsumer&, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c03a5a)
#13 0x0000000006c0ec9e clang::Sema::makeTypoCorrectionConsumer(clang::DeclarationNameInfo const&, clang::Sema::LookupNameKind, clang::Scope*, clang::CXXScopeSpec*, clang::CorrectionCandidateCallback&, clang::DeclContext*, bool, clang::ObjCObjectPointerType const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c0ec9e)
#14 0x0000000006c10a1f clang::Sema::CorrectTypo(clang::DeclarationNameInfo const&, clang::Sema::LookupNameKind, clang::Scope*, clang::CXXScopeSpec*, clang::CorrectionCandidateCallback&, clang::Sema::CorrectTypoKind, clang::DeclContext*, bool, clang::ObjCObjectPointerType const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c10a1f)
#15 0x0000000006903c3a clang::Sema::BuildMemInitializer(clang::Decl*, clang::Scope*, clang::CXXScopeSpec&, clang::IdentifierInfo*, clang::OpaquePtr<clang::QualType>, clang::DeclSpec const&, clang::SourceLocation, clang::Expr*, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6903c3a)
#16 0x000000000651843a clang::Parser::ParseMemInitializer(clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651843a)
#17 0x0000000006519d45 clang::Parser::ParseConstructorInitializer(clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6519d45)
#18 0x00000000064d8138 clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64d8138)
#19 0x00000000064d7c9d clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64d7c9d)
#20 0x000000000652a30e clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x652a30e)
#21 0x000000000652c913 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x652c913)
#22 0x0000000006500918 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6500918)
#23 0x00000000064bd2e4 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64bd2e4)
#24 0x00000000064bdd49 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64bdd49)
#25 0x00000000064c5613 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64c5613)
#26 0x0000000006521f14 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6521f14)
#27 0x0000000006522b43 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6522b43)
#28 0x0000000006507610 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6507610)
#29 0x00000000064c5657 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64c5657)
#30 0x00000000064c652d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64c652d)
#31 0x00000000064b8a7a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64b8a7a)
#32 0x0000000004827f98 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4827f98)
#33 0x0000000004b158e5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b158e5)
#34 0x0000000004a9759e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4a9759e)
#35 0x0000000004c05b4e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c05b4e)
#36 0x0000000000d51dcf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd51dcf)
#37 0x0000000000d4958a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#38 0x000000000488d679 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
#39 0x0000000003dd8b24 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3dd8b24)
#40 0x000000000488dc8f 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
#41 0x00000000048506fd clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48506fd)
#42 0x000000000485178e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x485178e)
#43 0x0000000004858e65 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4858e65)
#44 0x0000000000d4ebc8 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd4ebc8)
#45 0x0000000000c15884 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc15884)
#46 0x000075afca429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#47 0x000075afca429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#48 0x0000000000d49035 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd49035)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkW11z27bS_jX0DUYaEvy-8IUiR6n7Jo3f2NPxnQcElhJrimAB0JXz688AoMwPUXLcsXJOpx03lglg8eyzi90FCBEpi3UFcOmEH5zw6oI0asPF5bdGbjwX-_5Fxtnz5ScOEmWEPiLFES1JtZ5Fjr9AG6Vq6fgLB68cvFpzlvFSzblYO3j13cEr6bH0O3i7Px134biLT1CBIAoYyp5R3nz_DgIp8VxUay2XMKZlS4m2sM1AyLkddQvAUC34WpDtxKSF2jTZnPKtg1dl-bT_NasF_wOocvAqK3nm4NWWFJWDVwa-g1cKpG68hS1Z3t_rBl4_zyivpBINVVzMQAgu5rSuWxxKE3DVbGs9uXnkRK79oQ7-oH_cRSve_OUvkINXgnN1CGoPo6ho2TDoPVnc3jl4dQW0XN7fzzeOv0hiT8t64gWz7GsA_mJ5f_8NKBdM97WPJKjrbV0WtFBLXj8vO22u5RWUoIA5OHFwquUtpAShCl4hrQROGFHEts6vICdNqYAdk4KceOnES1QBMPn1CUTJCfsGkpeNlrjiYjSynRanyMGRgyPkYKy7oB7jSG54UzJUcYUyQGwPGDs4RjkpSmDaJ24-f1zcfkSyybaFQgRlzRoJqLlQ2o3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