Issue |
130349
|
Summary |
[Clang][Modules] Crash on using-declaration of imported closure base class ctor
|
Labels |
clang
|
Assignees |
|
Reporter |
MagentaTreehouse
|
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>
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs