Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE on valid(?) C++20 code #64808

Open
ericniebler opened this issue Aug 18, 2023 · 4 comments
Open

ICE on valid(?) C++20 code #64808

ericniebler opened this issue Aug 18, 2023 · 4 comments
Assignees
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@ericniebler
Copy link

[build] Stack dump:
[build] 0.	Program arguments: /usr/bin/clang++-16 -I/home/eniebler/Code/stdexec/include -fsanitize=address -g -std=gnu++20 -Wall -ferror-limit=0 -fmacro-backtrace-limit=0 -ftemplate-backtrace-limit=0 -MD -MT examples/CMakeFiles/example.hello_world.dir/hello_world.cpp.o -MF examples/CMakeFiles/example.hello_world.dir/hello_world.cpp.o.d -o examples/CMakeFiles/example.hello_world.dir/hello_world.cpp.o -c /home/eniebler/Code/stdexec/examples/hello_world.cpp
[build] 1.	/home/eniebler/Code/stdexec/include/stdexec/execution.hpp:2366:50: current parser token ')'
[build] 2.	/home/eniebler/Code/stdexec/include/stdexec/execution.hpp:91:1: parsing namespace 'stdexec'
[build] 3.	/home/eniebler/Code/stdexec/include/stdexec/execution.hpp:2338:3: parsing namespace 'stdexec::__inln'
[build] 4.	/home/eniebler/Code/stdexec/include/stdexec/execution.hpp:2361:5: parsing struct/union/class body 'stdexec::__inln::__scheduler'
[build] 5.	/home/eniebler/Code/stdexec/include/stdexec/execution.hpp:2365:55: parsing function body 'stdexec::__inln::tag_invoke'
[build] 6.	/home/eniebler/Code/stdexec/include/stdexec/execution.hpp:2365:55: in compound statement ('{}')
[build] 7.	/home/eniebler/Code/stdexec/include/stdexec/__detail/__sender_utils.hpp:138:5: instantiating function definition 'stdexec::(anonymous class)::operator()<stdexec::__inln::__schedule_t, stdexec::__>'
[build] 8.	/home/eniebler/Code/stdexec/include/stdexec/__detail/__sender_utils.hpp:59:10: instantiating class definition 'stdexec::__basic_sender<(lambda at /home/eniebler/Code/stdexec/include/stdexec/__detail/__sender_utils.hpp:143:14)>'
[build] Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
[build] 0  libLLVM-16.so.1    0x00007feedfdbe706 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 54
[build] 1  libLLVM-16.so.1    0x00007feedfdbc8a0 llvm::sys::RunSignalHandlers() + 80
[build] 2  libLLVM-16.so.1    0x00007feedfcfd0f0
[build] 3  libc.so.6          0x00007feede642520
[build] 4  libclang-cpp.so.16 0x00007feee80a225e clang::Sema::CheckParameterPacksForExpansion(clang::SourceLocation, clang::SourceRange, llvm::ArrayRef<std::pair<llvm::PointerUnion<clang::TemplateTypeParmType const*, clang::NamedDecl*>, clang::SourceLocation>>, clang::MultiLevelTemplateArgumentList const&, bool&, bool&, std::optional<unsigned int>&) + 382
[build] 5  libclang-cpp.so.16 0x00007feee8039371
[build] 6  libclang-cpp.so.16 0x00007feee803f3ab
[build] 7  libclang-cpp.so.16 0x00007feee804d551
[build] 8  libclang-cpp.so.16 0x00007feee8044c79
[build] 9  libclang-cpp.so.16 0x00007feee8038d82 clang::Sema::SubstConstraintExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) + 82
[build] 10 libclang-cpp.so.16 0x00007feee7a66e17
[build] 11 libclang-cpp.so.16 0x00007feee7a65d09
[build] 12 libclang-cpp.so.16 0x00007feee7a60f6f
[build] 13 libclang-cpp.so.16 0x00007feee7a6091c clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) + 796
[build] 14 libclang-cpp.so.16 0x00007feee7a63215 clang::Sema::CheckInstantiatedFunctionTemplateConstraints(clang::SourceLocation, clang::FunctionDecl*, llvm::ArrayRef<clang::TemplateArgument>, clang::ConstraintSatisfaction&) + 837
[build] 15 libclang-cpp.so.16 0x00007feee7fd837f clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool, llvm::function_ref<bool ()>) + 3423
[build] 16 libclang-cpp.so.16 0x00007feee802b837
[build] 17 libclang-cpp.so.16 0x00007feee792e56d clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) + 61
[build] 18 libclang-cpp.so.16 0x00007feee7fd9821 clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>) + 2353
[build] 19 libclang-cpp.so.16 0x00007feee7eb6670 clang::Sema::AddMethodTemplateCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::CXXRecordDecl*, clang::TemplateArgumentListInfo*, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, clang::OverloadCandidateParamOrder) + 640
[build] 20 libclang-cpp.so.16 0x00007feee7eb7043 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder) + 211
[build] 21 libclang-cpp.so.16 0x00007feee7ecdee7 clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation) + 983
[build] 22 libclang-cpp.so.16 0x00007feee7be7c71 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) + 2337
[build] 23 libclang-cpp.so.16 0x00007feee7bffdad clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) + 77
[build] 24 libclang-cpp.so.16 0x00007feee803f4d1
[build] 25 libclang-cpp.so.16 0x00007feee8051bd7
[build] 26 libclang-cpp.so.16 0x00007feee8031590
[build] 27 libclang-cpp.so.16 0x00007feee8031f27 clang::Sema::SubstType(clang::QualType, clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation, clang::DeclarationName) + 135
[build] 28 libclang-cpp.so.16 0x00007feee7f3123a clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) + 858
[build] 29 libclang-cpp.so.16 0x00007feee8048158
[build] 30 libclang-cpp.so.16 0x00007feee80556b5
[build] 31 libclang-cpp.so.16 0x00007feee805361f
[build] 32 libclang-cpp.so.16 0x00007feee8031590
[build] 33 libclang-cpp.so.16 0x00007feee803124c clang::Sema::SubstType(clang::TypeSourceInfo*, clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation, clang::DeclarationName, bool) + 108
[build] 34 libclang-cpp.so.16 0x00007feee806770b clang::TemplateDeclInstantiator::InstantiateTypedefNameDecl(clang::TypedefNameDecl*, bool) + 107
[build] 35 libclang-cpp.so.16 0x00007feee80687a1 clang::TemplateDeclInstantiator::VisitTypeAliasDecl(clang::TypeAliasDecl*) + 17
[build] 36 libclang-cpp.so.16 0x00007feee8035316 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) + 1590
[build] 37 libclang-cpp.so.16 0x00007feee80371a5 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) + 2213
[build] 38 libclang-cpp.so.16 0x00007feee80e002e
[build] 39 libclang-cpp.so.16 0x00007feee792e56d clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) + 61
[build] 40 libclang-cpp.so.16 0x00007feee80d25fa clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) + 1786
[build] 41 libclang-cpp.so.16 0x00007feee80d1dd0 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) + 16
[build] 42 libclang-cpp.so.16 0x00007feee7cfd77f clang::Sema::BuildCXXTypeConstructExpr(clang::TypeSourceInfo*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, bool) + 2271
[build] 43 libclang-cpp.so.16 0x00007feee803f12a
[build] 44 libclang-cpp.so.16 0x00007feee805c445
[build] 45 libclang-cpp.so.16 0x00007feee8050240
[build] 46 libclang-cpp.so.16 0x00007feee8037bb4 clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) + 84
[build] 47 libclang-cpp.so.16 0x00007feee8077ee6 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) + 2662
[build] 48 libclang-cpp.so.16 0x00007feee792e56d clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) + 61
[build] 49 libclang-cpp.so.16 0x00007feee7fdcfc5 clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool) + 741
[build] 50 libclang-cpp.so.16 0x00007feee7be2fde clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*, bool) + 1102
[build] 51 libclang-cpp.so.16 0x00007feee7ec84c4
[build] 52 libclang-cpp.so.16 0x00007feee7ece99f clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation) + 3727
[build] 53 libclang-cpp.so.16 0x00007feee7be7c71 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) + 2337
[build] 54 libclang-cpp.so.16 0x00007feee7bffdad clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) + 77
[build] 55 libclang-cpp.so.16 0x00007feee7213c0c clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) + 5196
[build] 56 libclang-cpp.so.16 0x00007feee7214b25 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) + 213
[build] 57 libclang-cpp.so.16 0x00007feee7210da1 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 273
[build] 58 libclang-cpp.so.16 0x00007feee7210c79 clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
[build] 59 libclang-cpp.so.16 0x00007feee7274634 clang::Parser::ParseReturnStatement() + 260
[build] 60 libclang-cpp.so.16 0x00007feee726eca9 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) + 2649
[build] 61 libclang-cpp.so.16 0x00007feee726e01d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) + 349
[build] 62 libclang-cpp.so.16 0x00007feee72764b0 clang::Parser::ParseCompoundStatementBody(bool) + 1600
[build] 63 libclang-cpp.so.16 0x00007feee727756f clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) + 175
[build] 64 libclang-cpp.so.16 0x00007feee71d2171 clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 609
[build] 65 libclang-cpp.so.16 0x00007feee71d0e7a clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 74
[build] 66 libclang-cpp.so.16 0x00007feee7204b69 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) + 4457
[build] 67 libclang-cpp.so.16 0x00007feee7202416 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) + 7206
[build] 68 libclang-cpp.so.16 0x00007feee71e47e1 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) + 1857
[build] 69 libclang-cpp.so.16 0x00007feee72904c0 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) + 192
[build] 70 libclang-cpp.so.16 0x00007feee7290229 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) + 457
[build] 71 libclang-cpp.so.16 0x00007feee728f4c7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) + 1943
[build] 72 libclang-cpp.so.16 0x00007feee71fae1d clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 301
[build] 73 libclang-cpp.so.16 0x00007feee71fa7be clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) + 4766
[build] 74 libclang-cpp.so.16 0x00007feee71df8a1 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) + 1169
[build] 75 libclang-cpp.so.16 0x00007feee728ede5 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) + 181
[build] 76 libclang-cpp.so.16 0x00007feee71fae1d clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 301
[build] 77 libclang-cpp.so.16 0x00007feee71fa7be clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) + 4766
[build] 78 libclang-cpp.so.16 0x00007feee71df8a1 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) + 1169
[build] 79 libclang-cpp.so.16 0x00007feee728ede5 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) + 181
[build] 80 libclang-cpp.so.16 0x00007feee728d86e clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) + 1182
[build] 81 libclang-cpp.so.16 0x00007feee71cd51e clang::ParseAST(clang::Sema&, bool, bool) + 718
[build] 82 libclang-cpp.so.16 0x00007feee8de4bd5 clang::FrontendAction::Execute() + 85
[build] 83 libclang-cpp.so.16 0x00007feee8d61dc4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 724
[build] 84 libclang-cpp.so.16 0x00007feee8e5d654 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 660
[build] 85 clang++-16         0x000055a4f63cff4c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2348
[build] 86 clang++-16         0x000055a4f63cd1f0
[build] 87 libclang-cpp.so.16 0x00007feee8a3e632
[build] 88 libLLVM-16.so.1    0x00007feedfcfce8c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 140
[build] 89 libclang-cpp.so.16 0x00007feee8a3dd53 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 355
[build] 90 libclang-cpp.so.16 0x00007feee8a095d2 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 866
[build] 91 libclang-cpp.so.16 0x00007feee8a0982e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 142
[build] 92 libclang-cpp.so.16 0x00007feee8a23f8d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 349
[build] 93 clang++-16         0x000055a4f63cc8b5 clang_main(int, char**) + 11541
[build] 94 libc.so.6          0x00007feede629d90
[build] 95 libc.so.6          0x00007feede629e40 __libc_start_main + 128
[build] 96 clang++-16         0x000055a4f63c9855 _start + 37
[build] clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
[build] Ubuntu clang version 16.0.6 (++20230710042027+7cbf1a259152-1~exp1~20230710162048.105)
[build] Target: x86_64-pc-linux-gnu
[build] Thread model: posix
[build] InstalledDir: /usr/bin
[build] clang: note: diagnostic msg: 
[build] ********************
[build] 
[build] PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
[build] Preprocessed source(s) and associated run script(s) are located at:
[build] clang: note: diagnostic msg: /tmp/hello_world-ef8864.cpp
[build] clang: note: diagnostic msg: /tmp/hello_world-ef8864.sh
[build] clang: note: diagnostic msg: 
[build] 
[build] ********************

hello_world.zip

@EugeneZelenko EugeneZelenko added c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Aug 18, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 18, 2023

@llvm/issue-subscribers-clang-frontend

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 18, 2023

@llvm/issue-subscribers-c-20

@cor3ntin cor3ntin added the needs-reduction Large reproducer that should be reduced into a simpler form label Aug 19, 2023
@Endilll
Copy link
Contributor

Endilll commented Feb 6, 2024

One reduction of this crash has been fixed in post-18 trunk: https://godbolt.org/z/P1zad4cKP
Reduced by me and C-Reduce:

auto a = 
  [](auto... __captures) {
    return []() requires requires { 0(__captures...); } {};
  }()(); 

Clang 17 crash:


clang++: /root/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:4181:
llvm::PointerUnion<clang::Decl*, llvm::SmallVector<clang::VarDecl*, 4>*>* clang::LocalInstantiationScope::findInstantiationOf(const clang::Decl*):
Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"' 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-17.0.1/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-13.2.0 -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1.	<source>:4:7: current parser token ')'
 #0 0x00000000036e7558 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x36e7558)
 #1 0x00000000036e53dc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x36e53dc)
 #2 0x0000000003632918 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fc5d5642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007fc5d56969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007fc5d5642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007fc5d56287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007fc5d562871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007fc5d5639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000068e3b85 clang::LocalInstantiationScope::findInstantiationOf(clang::Decl const*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x68e3b85)
#10 0x0000000006989c59 clang::Sema::CheckParameterPacksForExpansion(clang::SourceLocation, clang::SourceRange, llvm::ArrayRef<std::pair<llvm::PointerUnion<clang::TemplateTypeParmType const*, clang::NamedDecl*>, clang::SourceLocation>>, clang::MultiLevelTemplateArgumentList const&, bool&, bool&, std::optional<unsigned int>&) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x6989c59)
#11 0x00000000068ec04d clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExprs(clang::Expr* const*, unsigned int, bool, llvm::SmallVectorImpl<clang::Expr*>&, bool*) SemaTemplateInstantiate.cpp:0:0
#12 0x00000000068f48e1 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) SemaTemplateInstantiate.cpp:0:0
#13 0x00000000068eafe2 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#14 0x0000000006913311 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformRequiresExpr(clang::RequiresExpr*) SemaTemplateInstantiate.cpp:0:0
#15 0x0000000006914d1e (anonymous namespace)::TemplateInstantiator::TransformRequiresExpr(clang::RequiresExpr*) SemaTemplateInstantiate.cpp:0:0
#16 0x00000000068eab42 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#17 0x0000000006925718 clang::Sema::SubstConstraintExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x6925718)
#18 0x00000000060954e7 calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)::operator()(clang::Expr const*) const SemaConcept.cpp:0:0
#19 0x0000000006096b3b clang::ActionResult<clang::Expr*, true> calculateConstraintSatisfaction<calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)>(clang::Sema&, clang::Expr const*, clang::ConstraintSatisfaction&, calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)&&) SemaConcept.cpp:0:0
#20 0x0000000006097342 CheckConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) SemaConcept.cpp:0:0
#21 0x000000000609797a clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x609797a)
#22 0x00000000060993d3 clang::Sema::CheckFunctionConstraints(clang::FunctionDecl const*, clang::ConstraintSatisfaction&, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x60993d3)
#23 0x00000000066cbf54 clang::Sema::AddMethodCandidate(clang::CXXMethodDecl*, clang::DeclAccessPair, clang::CXXRecordDecl*, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, llvm::MutableArrayRef<clang::ImplicitConversionSequence>, clang::OverloadCandidateParamOrder) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x66cbf54)
#24 0x00000000066cd3eb clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x66cd3eb)
#25 0x00000000066e7d3b clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x66e7d3b)
#26 0x000000000638eed8 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x638eed8)
#27 0x0000000006390d3c clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x6390d3c)
#28 0x0000000005e585c0 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5e585c0)
#29 0x0000000005e50751 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5e50751)
#30 0x0000000005e5389a clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5e5389a)
#31 0x0000000005e53a39 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5e53a39)
#32 0x0000000005e1502d clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5e1502d)
#33 0x0000000005e21f40 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5e21f40)
#34 0x0000000005defc4a clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5defc4a)
#35 0x0000000005df04df clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#36 0x0000000005df6b51 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5df6b51)
#37 0x0000000005df7452 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5df7452)
#38 0x0000000005df78a0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5df78a0)
#39 0x0000000005deb732 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x5deb732)
#40 0x0000000004939258 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x4939258)
#41 0x00000000041a1c09 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x41a1c09)
#42 0x00000000041278ce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x41278ce)
#43 0x0000000004281de6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x4281de6)
#44 0x0000000000bc67eb cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0xbc67eb)
#45 0x0000000000bbefaa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#46 0x0000000003f83419 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
#47 0x0000000003632dc4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x3632dc4)
#48 0x0000000003f83a0f 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
#49 0x0000000003f4b275 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x3f4b275)
#50 0x0000000003f4bcdd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x3f4bcdd)
#51 0x0000000003f5385d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0x3f5385d)
#52 0x0000000000bc4a87 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0xbc4a87)
#53 0x0000000000abef61 main (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0xabef61)
#54 0x00007fc5d5629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#55 0x00007fc5d5629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#56 0x0000000000bbea8e _start (/opt/compiler-explorer/clang-assertions-17.0.1/bin/clang+++0xbbea8e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

@Endilll
Copy link
Contributor

Endilll commented Feb 6, 2024

However, a different reduction is still crashing in post-18 trunk: https://godbolt.org/z/MP45d35bj
Reduced by me and C-Reduce:

template <class _ImplFn>
struct __basic_sender {
   __basic_sender(_ImplFn);
};

auto a = 
  __basic_sender {
    [](auto... __captures) {
      return []() requires requires { 0(__captures...); } {};
    }()
  }

Backtrace:

clang++: /root/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:4272: llvm::PointerUnion<clang::Decl*, llvm::SmallVector<clang::VarDecl*, 4>*>* clang::LocalInstantiationScope::findInstantiationOf(const clang::Decl*): Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"' 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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1.	<eof> parser at end of file
 #0 0x000000000388a128 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x388a128)
 #1 0x0000000003887e0c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3887e0c)
 #2 0x00000000037d02e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f628b042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f628b0969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007f628b042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f628b0287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007f628b02871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007f628b039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000006bfc5ac clang::LocalInstantiationScope::findInstantiationOf(clang::Decl const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6bfc5ac)
#10 0x0000000006ca93a9 clang::Sema::CheckParameterPacksForExpansion(clang::SourceLocation, clang::SourceRange, llvm::ArrayRef<std::pair<llvm::PointerUnion<clang::TemplateTypeParmType const*, clang::NamedDecl*>, clang::SourceLocation>>, clang::MultiLevelTemplateArgumentList const&, bool&, bool&, std::optional<unsigned int>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ca93a9)
#11 0x0000000006c054fd clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExprs(clang::Expr* const*, unsigned int, bool, llvm::SmallVectorImpl<clang::Expr*>&, bool*) SemaTemplateInstantiate.cpp:0:0
#12 0x0000000006c0fa21 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) SemaTemplateInstantiate.cpp:0:0
#13 0x0000000006c03d28 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#14 0x0000000006c2f076 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformRequiresExpr(clang::RequiresExpr*) SemaTemplateInstantiate.cpp:0:0
#15 0x0000000006c30c5e (anonymous namespace)::TemplateInstantiator::TransformRequiresExpr(clang::RequiresExpr*) SemaTemplateInstantiate.cpp:0:0
#16 0x0000000006c04201 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#17 0x0000000006c39ac4 clang::Sema::SubstConstraintExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6c39ac4)
#18 0x0000000006389670 calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)::operator()(clang::Expr const*) const SemaConcept.cpp:0:0
#19 0x000000000638ad5b clang::ActionResult<clang::Expr*, true> calculateConstraintSatisfaction<calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)>(clang::Sema&, clang::Expr const*, clang::ConstraintSatisfaction&, calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)&&) SemaConcept.cpp:0:0
#20 0x000000000638b572 CheckConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) SemaConcept.cpp:0:0
#21 0x000000000638bbaa clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x638bbaa)
#22 0x000000000638d6d0 clang::Sema::CheckFunctionConstraints(clang::FunctionDecl const*, clang::ConstraintSatisfaction&, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x638d6d0)
#23 0x000000000638d062 clang::Sema::CheckFunctionConstraints(clang::FunctionDecl const*, clang::ConstraintSatisfaction&, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x638d062)
#24 0x00000000069d5bfc clang::Sema::AddConversionCandidate(clang::CXXConversionDecl*, clang::DeclAccessPair, clang::CXXRecordDecl*, clang::Expr*, clang::QualType, clang::OverloadCandidateSet&, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69d5bfc)
#25 0x00000000069dd61c IsUserDefinedConversion(clang::Sema&, clang::Expr*, clang::QualType, clang::UserDefinedConversionSequence&, clang::OverloadCandidateSet&, clang::Sema::AllowedExplicit, bool) SemaOverload.cpp:0:0
#26 0x00000000069de2a0 TryUserDefinedConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) (.constprop.0) SemaOverload.cpp:0:0
#27 0x00000000069de854 TryImplicitConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) SemaOverload.cpp:0:0
#28 0x00000000069d7ba7 TryReferenceInit(clang::Sema&, clang::Expr*, clang::QualType, clang::SourceLocation, bool, bool) SemaOverload.cpp:0:0
#29 0x00000000069d91bf TryCopyInitialization(clang::Sema&, clang::Expr*, clang::QualType, bool, bool, bool, bool) SemaOverload.cpp:0:0
#30 0x00000000069dbd46 clang::Sema::AddOverloadCandidate(clang::FunctionDecl*, clang::DeclAccessPair, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, bool, clang::CallExpr::ADLCallKind, llvm::MutableArrayRef<clang::ImplicitConversionSequence>, clang::OverloadCandidateParamOrder, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x69dbd46)
#31 0x0000000006825000 ResolveConstructorOverload(clang::Sema&, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::QualType, clang::DeclContextLookupResult, clang::OverloadCandidate*&, bool, bool, bool, bool, bool, bool) SemaInit.cpp:0:0
#32 0x00000000068366d2 TryConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType, clang::QualType, clang::InitializationSequence&, bool, bool) SemaInit.cpp:0:0
#33 0x0000000006840843 TryListInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, clang::InitListExpr*, clang::InitializationSequence&, bool) SemaInit.cpp:0:0
#34 0x000000000683de7b clang::InitializationSequence::InitializeFrom(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x683de7b)
#35 0x0000000006755be1 clang::Sema::BuildCXXTypeConstructExpr(clang::TypeSourceInfo*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6755be1)
#36 0x00000000067e22ed clang::Sema::ActOnCXXTypeConstructExpr(clang::OpaquePtr<clang::QualType>, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67e22ed)
#37 0x0000000006158d06 clang::Parser::ParseCXXTypeConstructExpression(clang::DeclSpec const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6158d06)
#38 0x000000000613b6b5 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x613b6b5)
#39 0x000000000613a24a clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x613a24a)
#40 0x000000000613d28a clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x613d28a)
#41 0x000000000613d429 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x613d429)
#42 0x00000000060faebd clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60faebd)
#43 0x0000000006109e7a clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6109e7a)
#44 0x00000000060c7c1e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60c7c1e)
#45 0x00000000060c83f1 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60c83f1)
#46 0x00000000060cf6b6 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60cf6b6)
#47 0x00000000060d055d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60d055d)
#48 0x00000000060c341a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60c341a)
#49 0x0000000004118c48 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4118c48)
#50 0x0000000004389719 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4389719)
#51 0x00000000043081ee clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43081ee)
#52 0x000000000446940e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x446940e)
#53 0x0000000000c126b6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc126b6)
#54 0x0000000000c09eca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#55 0x000000000415a1f9 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
#56 0x00000000037d0794 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x37d0794)
#57 0x000000000415a7ef 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
#58 0x00000000041224e5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41224e5)
#59 0x0000000004122f4d 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+++0x4122f4d)
#60 0x000000000412ae85 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x412ae85)
#61 0x0000000000c0fa3c clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc0fa3c)
#62 0x0000000000b06be4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb06be4)
#63 0x00007f628b029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#64 0x00007f628b029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#65 0x0000000000c099ae _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc099ae)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

@Endilll Endilll added confirmed Verified by a second party and removed needs-reduction Large reproducer that should be reduced into a simpler form labels Feb 6, 2024
@zyn0217 zyn0217 self-assigned this Feb 26, 2024
zyn0217 added a commit to zyn0217/llvm-project that referenced this issue Feb 29, 2024
…ints

This fixes the case shown by llvm#64808 (comment).

Similar to llvm@f9caa12,
we have some calls to constraint checking for a lambda's conversion
function while determining the conversion sequence.

This patch addresses the problem where the requires-expression within
such a lambda references to a Decl outside of the lambda by adding
these Decls to the current instantiation scope.

I'm abusing the flag 'ForOverloadResolution' of CheckFunctionConstraints,
which is actually meant to consider the Decls from parent DeclContexts.
zyn0217 added a commit that referenced this issue Mar 16, 2024
…onversion function constraints (#83420)

This fixes the case shown by
#64808 (comment).

Similar to
f9caa12,
we have some calls to constraint checking for a lambda's conversion
function while determining the conversion sequence.

This patch addresses the problem where the requires-expression within
such a lambda references to a Decl outside of the lambda by adding these
Decls to the current instantiation scope.

I'm abusing the flag `ForOverloadResolution` of
CheckFunctionConstraints, which is actually meant to consider the Decls
from parent DeclContexts.

---------

Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
Status: No status
Development

No branches or pull requests

6 participants