<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/130349>130349</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang][Modules] Crash on using-declaration of imported closure base class ctor
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MagentaTreehouse
</td>
</tr>
</table>
<pre>
m.cppm
```c++
export module m;
export constexpr auto f{[] {}};
```
main.cpp
```c++
import m;
using Base = decltype(f);
struct A: Base {
using Base::Base;
};
int main() {}
```
See https://compiler-explorer.com/z/E84Tqorf4.
Assertion:
```console
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.
```
<details>
<summary>Stack dump</summary>
```console
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d @CMakeFiles/main.dir/main.cpp.o.modmap -o CMakeFiles/main.dir/main.cpp.o -c /app/main.cpp
1. /app/main.cpp:7:2: current parser token ';'
2. /app/main.cpp:5:1: parsing struct/union/class body 'A'
#0 0x0000000003e66ab8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e66ab8)
#1 0x0000000003e64774 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e64774)
#2 0x0000000003db1088 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000077236dc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000077236dc969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000077236dc42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000077236dc287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000077236dc2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000077236dc39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000006896665 clang::Sema::DeclareImplicitCopyConstructor(clang::CXXRecordDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6896665)
#10 0x00000000068976bb clang::Sema::AddImplicitlyDeclaredMembersToClass(clang::CXXRecordDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68976bb)
#11 0x000000000679e048 clang::Sema::ActOnFields(clang::Scope*, clang::SourceLocation, clang::Decl*, llvm::ArrayRef<clang::Decl*>, clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesView const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x679e048)
#12 0x00000000068a0019 clang::Sema::ActOnFinishCXXMemberSpecification(clang::Scope*, clang::SourceLocation, clang::Decl*, clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesView const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68a0019)
#13 0x000000000648e20b clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x648e20b)
#14 0x0000000006490883 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+++0x6490883)
#15 0x0000000006464ac8 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+++0x6464ac8)
#16 0x0000000006421e34 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6421e34)
#17 0x0000000006422899 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6422899)
#18 0x000000000642a073 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x642a073)
#19 0x000000000642af4d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x642af4d)
#20 0x000000000641d3da clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x641d3da)
#21 0x0000000004829f58 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4829f58)
#22 0x0000000004af1e65 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4af1e65)
#23 0x0000000004a7563e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4a7563e)
#24 0x0000000004be0fae clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4be0fae)
#25 0x0000000000d51047 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd51047)
#26 0x0000000000d47e0a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x0000000004871f19 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
#28 0x0000000003db1534 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3db1534)
#29 0x000000000487250f 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
#30 0x000000000483512d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x483512d)
#31 0x00000000048361ae 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+++0x48361ae)
#32 0x000000000483e145 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x483e145)
#33 0x0000000000d4d2e3 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd4d2e3)
#34 0x0000000000c14ea4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc14ea4)
#35 0x000077236dc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#36 0x000077236dc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#37 0x0000000000d478b5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd478b5)
```
</details>
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkWl1zo7jS_jXKjcouEJiPi1wwON539p3UTE1SW7lzCWhsTgRiJZFNzq8_JQkbgz82ORXPqVNny1tDUKv19NOt7kZApaw2DcAtWnxBi-UN7dSWi9t7uoFG0UcBsOWdhJuMF2-39Txv2xo5CQoc-8sR-aJ_TgKvLRcK17zoGOAaeQc3c95IBa-twLRTHJco_GKXw_oqXOqfkd_r1ddOUtOq0UueXrGq7Yr9VCfpZNVs8BcqASNviQvImXprAZGoRCTei0klulzhBHlJLxzqEYwxHjQgT4_bKzNvD9FJqkZhDQ2RCJF4Z8MR-gcAvFWqlVoXWSGyynndVgzEDF5bxgWIec5rRFb_RGR1F_mPf3JR-nM7O5EShKp4o2cf2s8byRkgJ8kZbTY9G16CEVkJzhUiK8Ze6lkr-D8g13_2cquqyVlXwMGd5OERkdUScpY-Pc23yEui0LXrvfCqwFbOMJE-Pf2EnItCS9tbEtTXumVVXqmUt2-pdrJmlouvcgkMFBSWIatxbxDWhpCooIra8fkSStoxBcU5PRiFKQpT3AAU8vsLCMZp8RMkZ53WuOJiMrNfWHuHBIgEGBGiRWwoWhkst7xjBW64whngYgeZIBLiklYMivmxV5GXFqBoxSTy7va3ZFfXVLwh7-5B0fwZF13dIi9FZDWM9MLHjnTmyIl_CL4RtMZUbLoaGiV7n_JWnYqcnRdndEernCnRNc-IrDIdmquD8MCz2SbPZ4pzlm914HrLi5q1sGxoK7dc4VmZc8bFrKjopuFSVbnEs7Lhs1xQuR3flqpA3rLfosTBs_slnt0_4vSePsOqYiARWZldXVRid5m37Zzj2f3qHWLzAiPfeYdczYuatnjG37V2rpmmbXtwGzmJq_1yPOAlIfISov2Td0JAo3BLhQSBFX-GBiMS6lRBQuQk5JyKBfISvdXMVJ10bFQisuoavemN_6TEOu9qjYnVhxHxHOy8Orv_PAgCmkV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