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

[LLVM-18.1.3] Parser CRASHING on requires expression #88081

Closed
nyyakko opened this issue Apr 9, 2024 · 6 comments · Fixed by #93206
Closed

[LLVM-18.1.3] Parser CRASHING on requires expression #88081

nyyakko opened this issue Apr 9, 2024 · 6 comments · Fixed by #93206
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@nyyakko
Copy link

nyyakko commented Apr 9, 2024

System:
Windows 10 Pro 21H2

clang++:

PS C:\Users\Wellington> clang++ --version
clang version 18.1.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

Snippet:

struct S
{
    S(auto value)
        requires (requires () { [&] -> decltype(value) {}; })
    {}
};

Backtrace:

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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++23 <source>
1.	<source>:4:54: current parser token ')'
2.	<source>:1:1: parsing struct/union/class body 'S'
3.	<source>:4:33: lambda expression parsing
 #0 0x00000000036ae888 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36ae888)
 #1 0x00000000036ac9d4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36ac9d4)
 #2 0x00000000035f5508 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fdf34242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000000000634a8c7 clang::Sema::tryCaptureVariable(clang::ValueDecl*, clang::SourceLocation, clang::Sema::TryCaptureKind, clang::SourceLocation, bool, clang::QualType&, clang::QualType&, unsigned int const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x634a8c7)
 #5 0x00000000063779ed clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::NestedNameSpecifierLoc, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x63779ed)
 #6 0x000000000637807f clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&, clang::CXXScopeSpec const*, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637807f)
 #7 0x000000000637d15d clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&, clang::DeclarationNameInfo const&, clang::NamedDecl*, clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637d15d)
 #8 0x000000000637d692 clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&, clang::LookupResult&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637d692)
 #9 0x0000000006382c3c clang::Sema::ActOnIdExpression(clang::Scope*, clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&, bool, bool, clang::CorrectionCandidateCallback*, bool, clang::Token*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6382c3c)
#10 0x0000000005e3b70f clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3b70f)
#11 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#12 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#13 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#14 0x0000000005e1de3e clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e1de3e)
#15 0x0000000005e588ab clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool, clang::IdentifierInfo**, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e588ab)
#16 0x0000000005dc12ec clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc12ec)
#17 0x0000000005e01a00 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e01a00)
#18 0x0000000005e02d11 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e02d11)
#19 0x0000000005e0319f clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e0319f)
#20 0x0000000005e5e170 clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e5e170)
#21 0x0000000005e5ea5b clang::Parser::ParseLambdaExpression() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e5ea5b)
#22 0x0000000005e3bb4b clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3bb4b)
#23 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#24 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#25 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#26 0x0000000005e53a10 clang::Parser::ParseRequiresExpression() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e53a10)
#27 0x0000000005e3aa6e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3aa6e)
#28 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#29 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#30 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#31 0x0000000005e47f0d clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e47f0d)
#32 0x0000000005e3b2c4 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3b2c4)
#33 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#34 0x0000000005e4725a clang::Parser::ParseConstraintLogicalAndExpression(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e4725a)
#35 0x0000000005e476fd clang::Parser::ParseConstraintLogicalOrExpression(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e476fd)
#36 0x0000000005e1c282 clang::Parser::ParseTrailingRequiresClause(clang::Declarator&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e1c282)
#37 0x0000000005e27609 clang::Parser::ParseCXXMemberDeclaratorBeforeInitializer(clang::Declarator&, clang::VirtSpecifiers&, clang::ActionResult<clang::Expr*, true>&, clang::Parser::LateParsedAttrList&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e27609)
#38 0x0000000005e2ce13 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2ce13)
#39 0x0000000005e2f7fc clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::ParsedAttributes&, clang::TypeSpecifierType, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2f7fc)
#40 0x0000000005e2ff6e clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2ff6e)
#41 0x0000000005e339b8 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e339b8)
#42 0x0000000005dffcee clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dffcee)
#43 0x0000000005dc3b37 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc3b37)
#44 0x0000000005dc4ab3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc4ab3)
#45 0x0000000005dcd152 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcd152)
#46 0x0000000005dcecc7 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcecc7)
#47 0x0000000005dcf2e0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcf2e0)
#48 0x0000000005dbdc9c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dbdc9c)
#49 0x0000000003f11195 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f11195)
#50 0x00000000041a65b1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41a65b1)
#51 0x000000000412c93b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x412c93b)
#52 0x000000000428a013 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x428a013)
#53 0x0000000000c4db5c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4db5c)
#54 0x0000000000c47b0d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#55 0x0000000003f59fe9 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 0x00000000035f5933 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35f5933)
#57 0x0000000003f5a209 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 0x0000000003f207e7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f207e7)
#59 0x0000000003f2119d 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+++0x3f2119d)
#60 0x0000000003f2af8c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f2af8c)
#61 0x0000000000c4afc1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4afc1)
#62 0x0000000000b2f084 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb2f084)
#63 0x00007fdf34229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#64 0x00007fdf34229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#65 0x0000000000c4766e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4766e)
@nyyakko
Copy link
Author

nyyakko commented Apr 9, 2024

godbolt link to the failing code https://gcc.godbolt.org/z/jT8zedTax

@EugeneZelenko EugeneZelenko added c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Apr 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 9, 2024

@llvm/issue-subscribers-c-20

Author: nyako (nyyakko)

System: `Windows 10 Pro 21H2`

clang++:

PS C:\Users\Wellington&gt; clang++ --version
clang version 18.1.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

Snippet:

struct S
{
    S(auto value)
        requires (requires () { [&amp;] -&gt; decltype(value) {}; })
    {}
};

Backtrace:

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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++23 &lt;source&gt;
1.	&lt;source&gt;:4:54: current parser token ')'
2.	&lt;source&gt;:1:1: parsing struct/union/class body 'S'
3.	&lt;source&gt;:4:33: lambda expression parsing
 #<!-- -->0 0x00000000036ae888 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36ae888)
 #<!-- -->1 0x00000000036ac9d4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36ac9d4)
 #<!-- -->2 0x00000000035f5508 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #<!-- -->3 0x00007fdf34242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x000000000634a8c7 clang::Sema::tryCaptureVariable(clang::ValueDecl*, clang::SourceLocation, clang::Sema::TryCaptureKind, clang::SourceLocation, bool, clang::QualType&amp;, clang::QualType&amp;, unsigned int const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x634a8c7)
 #<!-- -->5 0x00000000063779ed clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&amp;, clang::NestedNameSpecifierLoc, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x63779ed)
 #<!-- -->6 0x000000000637807f clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&amp;, clang::CXXScopeSpec const*, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637807f)
 #<!-- -->7 0x000000000637d15d clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&amp;, clang::DeclarationNameInfo const&amp;, clang::NamedDecl*, clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637d15d)
 #<!-- -->8 0x000000000637d692 clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&amp;, clang::LookupResult&amp;, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637d692)
 #<!-- -->9 0x0000000006382c3c clang::Sema::ActOnIdExpression(clang::Scope*, clang::CXXScopeSpec&amp;, clang::SourceLocation, clang::UnqualifiedId&amp;, bool, bool, clang::CorrectionCandidateCallback*, bool, clang::Token*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6382c3c)
#<!-- -->10 0x0000000005e3b70f clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3b70f)
#<!-- -->11 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#<!-- -->12 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#<!-- -->13 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#<!-- -->14 0x0000000005e1de3e clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e1de3e)
#<!-- -->15 0x0000000005e588ab clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&amp;, clang::OpaquePtr&lt;clang::QualType&gt;, bool, bool, bool*, bool, clang::IdentifierInfo**, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e588ab)
#<!-- -->16 0x0000000005dc12ec clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc12ec)
#<!-- -->17 0x0000000005e01a00 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e01a00)
#<!-- -->18 0x0000000005e02d11 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&amp;, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e02d11)
#<!-- -->19 0x0000000005e0319f clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e0319f)
#<!-- -->20 0x0000000005e5e170 clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e5e170)
#<!-- -->21 0x0000000005e5ea5b clang::Parser::ParseLambdaExpression() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e5ea5b)
#<!-- -->22 0x0000000005e3bb4b clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3bb4b)
#<!-- -->23 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#<!-- -->24 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#<!-- -->25 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#<!-- -->26 0x0000000005e53a10 clang::Parser::ParseRequiresExpression() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e53a10)
#<!-- -->27 0x0000000005e3aa6e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3aa6e)
#<!-- -->28 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#<!-- -->29 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#<!-- -->30 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#<!-- -->31 0x0000000005e47f0d clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&amp;, bool, bool, clang::OpaquePtr&lt;clang::QualType&gt;&amp;, clang::SourceLocation&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e47f0d)
#<!-- -->32 0x0000000005e3b2c4 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3b2c4)
#<!-- -->33 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#<!-- -->34 0x0000000005e4725a clang::Parser::ParseConstraintLogicalAndExpression(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e4725a)
#<!-- -->35 0x0000000005e476fd clang::Parser::ParseConstraintLogicalOrExpression(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e476fd)
#<!-- -->36 0x0000000005e1c282 clang::Parser::ParseTrailingRequiresClause(clang::Declarator&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e1c282)
#<!-- -->37 0x0000000005e27609 clang::Parser::ParseCXXMemberDeclaratorBeforeInitializer(clang::Declarator&amp;, clang::VirtSpecifiers&amp;, clang::ActionResult&lt;clang::Expr*, true&gt;&amp;, clang::Parser::LateParsedAttrList&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e27609)
#<!-- -->38 0x0000000005e2ce13 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::ParsingDeclRAIIObject*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2ce13)
#<!-- -->39 0x0000000005e2f7fc clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&amp;, clang::ParsedAttributes&amp;, clang::TypeSpecifierType, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2f7fc)
#<!-- -->40 0x0000000005e2ff6e clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&amp;, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2ff6e)
#<!-- -->41 0x0000000005e339b8 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e339b8)
#<!-- -->42 0x0000000005dffcee clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dffcee)
#<!-- -->43 0x0000000005dc3b37 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec&amp;, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc3b37)
#<!-- -->44 0x0000000005dc4ab3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc4ab3)
#<!-- -->45 0x0000000005dcd152 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcd152)
#<!-- -->46 0x0000000005dcecc7 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcecc7)
#<!-- -->47 0x0000000005dcf2e0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcf2e0)
#<!-- -->48 0x0000000005dbdc9c clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dbdc9c)
#<!-- -->49 0x0000000003f11195 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f11195)
#<!-- -->50 0x00000000041a65b1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41a65b1)
#<!-- -->51 0x000000000412c93b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x412c93b)
#<!-- -->52 0x000000000428a013 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x428a013)
#<!-- -->53 0x0000000000c4db5c cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4db5c)
#<!-- -->54 0x0000000000c47b0d ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) driver.cpp:0:0
#<!-- -->55 0x0000000003f59fe9 void llvm::function_ref&lt;void ()&gt;::callback_fn&lt;clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const::'lambda'()&gt;(long) Job.cpp:0:0
#<!-- -->56 0x00000000035f5933 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35f5933)
#<!-- -->57 0x0000000003f5a209 clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (.part.0) Job.cpp:0:0
#<!-- -->58 0x0000000003f207e7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f207e7)
#<!-- -->59 0x0000000003f2119d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f2119d)
#<!-- -->60 0x0000000003f2af8c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f2af8c)
#<!-- -->61 0x0000000000c4afc1 clang_main(int, char**, llvm::ToolContext const&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4afc1)
#<!-- -->62 0x0000000000b2f084 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb2f084)
#<!-- -->63 0x00007fdf34229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->64 0x00007fdf34229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->65 0x0000000000c4766e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4766e)

@llvmbot
Copy link
Member

llvmbot commented Apr 9, 2024

@llvm/issue-subscribers-clang-frontend

Author: nyako (nyyakko)

System: `Windows 10 Pro 21H2`

clang++:

PS C:\Users\Wellington&gt; clang++ --version
clang version 18.1.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

Snippet:

struct S
{
    S(auto value)
        requires (requires () { [&amp;] -&gt; decltype(value) {}; })
    {}
};

Backtrace:

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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++23 &lt;source&gt;
1.	&lt;source&gt;:4:54: current parser token ')'
2.	&lt;source&gt;:1:1: parsing struct/union/class body 'S'
3.	&lt;source&gt;:4:33: lambda expression parsing
 #<!-- -->0 0x00000000036ae888 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36ae888)
 #<!-- -->1 0x00000000036ac9d4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36ac9d4)
 #<!-- -->2 0x00000000035f5508 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #<!-- -->3 0x00007fdf34242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x000000000634a8c7 clang::Sema::tryCaptureVariable(clang::ValueDecl*, clang::SourceLocation, clang::Sema::TryCaptureKind, clang::SourceLocation, bool, clang::QualType&amp;, clang::QualType&amp;, unsigned int const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x634a8c7)
 #<!-- -->5 0x00000000063779ed clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&amp;, clang::NestedNameSpecifierLoc, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x63779ed)
 #<!-- -->6 0x000000000637807f clang::Sema::BuildDeclRefExpr(clang::ValueDecl*, clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&amp;, clang::CXXScopeSpec const*, clang::NamedDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637807f)
 #<!-- -->7 0x000000000637d15d clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&amp;, clang::DeclarationNameInfo const&amp;, clang::NamedDecl*, clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637d15d)
 #<!-- -->8 0x000000000637d692 clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&amp;, clang::LookupResult&amp;, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x637d692)
 #<!-- -->9 0x0000000006382c3c clang::Sema::ActOnIdExpression(clang::Scope*, clang::CXXScopeSpec&amp;, clang::SourceLocation, clang::UnqualifiedId&amp;, bool, bool, clang::CorrectionCandidateCallback*, bool, clang::Token*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6382c3c)
#<!-- -->10 0x0000000005e3b70f clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3b70f)
#<!-- -->11 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#<!-- -->12 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#<!-- -->13 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#<!-- -->14 0x0000000005e1de3e clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e1de3e)
#<!-- -->15 0x0000000005e588ab clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&amp;, clang::OpaquePtr&lt;clang::QualType&gt;, bool, bool, bool*, bool, clang::IdentifierInfo**, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e588ab)
#<!-- -->16 0x0000000005dc12ec clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc12ec)
#<!-- -->17 0x0000000005e01a00 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e01a00)
#<!-- -->18 0x0000000005e02d11 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&amp;, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e02d11)
#<!-- -->19 0x0000000005e0319f clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e0319f)
#<!-- -->20 0x0000000005e5e170 clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e5e170)
#<!-- -->21 0x0000000005e5ea5b clang::Parser::ParseLambdaExpression() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e5ea5b)
#<!-- -->22 0x0000000005e3bb4b clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3bb4b)
#<!-- -->23 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#<!-- -->24 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#<!-- -->25 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#<!-- -->26 0x0000000005e53a10 clang::Parser::ParseRequiresExpression() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e53a10)
#<!-- -->27 0x0000000005e3aa6e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3aa6e)
#<!-- -->28 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#<!-- -->29 0x0000000005e3d859 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d859)
#<!-- -->30 0x0000000005e42a39 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e42a39)
#<!-- -->31 0x0000000005e47f0d clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&amp;, bool, bool, clang::OpaquePtr&lt;clang::QualType&gt;&amp;, clang::SourceLocation&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e47f0d)
#<!-- -->32 0x0000000005e3b2c4 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3b2c4)
#<!-- -->33 0x0000000005e3d6ba clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e3d6ba)
#<!-- -->34 0x0000000005e4725a clang::Parser::ParseConstraintLogicalAndExpression(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e4725a)
#<!-- -->35 0x0000000005e476fd clang::Parser::ParseConstraintLogicalOrExpression(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e476fd)
#<!-- -->36 0x0000000005e1c282 clang::Parser::ParseTrailingRequiresClause(clang::Declarator&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e1c282)
#<!-- -->37 0x0000000005e27609 clang::Parser::ParseCXXMemberDeclaratorBeforeInitializer(clang::Declarator&amp;, clang::VirtSpecifiers&amp;, clang::ActionResult&lt;clang::Expr*, true&gt;&amp;, clang::Parser::LateParsedAttrList&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e27609)
#<!-- -->38 0x0000000005e2ce13 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::ParsingDeclRAIIObject*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2ce13)
#<!-- -->39 0x0000000005e2f7fc clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&amp;, clang::ParsedAttributes&amp;, clang::TypeSpecifierType, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2f7fc)
#<!-- -->40 0x0000000005e2ff6e clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&amp;, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e2ff6e)
#<!-- -->41 0x0000000005e339b8 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5e339b8)
#<!-- -->42 0x0000000005dffcee clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dffcee)
#<!-- -->43 0x0000000005dc3b37 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec&amp;, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc3b37)
#<!-- -->44 0x0000000005dc4ab3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dc4ab3)
#<!-- -->45 0x0000000005dcd152 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcd152)
#<!-- -->46 0x0000000005dcecc7 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcecc7)
#<!-- -->47 0x0000000005dcf2e0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dcf2e0)
#<!-- -->48 0x0000000005dbdc9c clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5dbdc9c)
#<!-- -->49 0x0000000003f11195 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f11195)
#<!-- -->50 0x00000000041a65b1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41a65b1)
#<!-- -->51 0x000000000412c93b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x412c93b)
#<!-- -->52 0x000000000428a013 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x428a013)
#<!-- -->53 0x0000000000c4db5c cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4db5c)
#<!-- -->54 0x0000000000c47b0d ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) driver.cpp:0:0
#<!-- -->55 0x0000000003f59fe9 void llvm::function_ref&lt;void ()&gt;::callback_fn&lt;clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const::'lambda'()&gt;(long) Job.cpp:0:0
#<!-- -->56 0x00000000035f5933 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35f5933)
#<!-- -->57 0x0000000003f5a209 clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (.part.0) Job.cpp:0:0
#<!-- -->58 0x0000000003f207e7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f207e7)
#<!-- -->59 0x0000000003f2119d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f2119d)
#<!-- -->60 0x0000000003f2af8c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f2af8c)
#<!-- -->61 0x0000000000c4afc1 clang_main(int, char**, llvm::ToolContext const&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4afc1)
#<!-- -->62 0x0000000000b2f084 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb2f084)
#<!-- -->63 0x00007fdf34229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->64 0x00007fdf34229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->65 0x0000000000c4766e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc4766e)

@shafik
Copy link
Collaborator

shafik commented Apr 9, 2024

Confirmed: https://gcc.godbolt.org/z/x1zMb783P

Assertion:

clang++: /root/llvm-project/llvm/include/llvm/ADT/SmallVector.h:304:
T& llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::operator[](llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type) [with T = clang::sema::FunctionScopeInfo*; <template-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::reference = clang::sema::FunctionScopeInfo*&; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type = long unsigned int]:
Assertion `idx < size()' failed.

Using assertions build is usually more helpful, since if it asserts it usually will be a better pointer to the real underlying problem.

@shafik shafik added the confirmed Verified by a second party label Apr 9, 2024
@zyn0217
Copy link
Contributor

zyn0217 commented Apr 9, 2024

I presume #78598 was supposed to fix this issue (and other duplicates) but the author gave up anyway.

@l1nxy
Copy link

l1nxy commented Apr 23, 2024

There is another example that cannot be resolved by #78598 as they are different.
#69307 only captures the scope variable in an unevaluated context, whereas this issue involves a lambda expression in an unevaluated context.
I am unsure how to fix this.
CC @shafik @cor3ntin

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" concepts C++20 concepts confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants