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

Concept checking assertion in Clang 16 #64086

Closed
alexolog opened this issue Jul 24, 2023 · 12 comments · Fixed by #76967
Closed

Concept checking assertion in Clang 16 #64086

alexolog opened this issue Jul 24, 2023 · 12 comments · Fixed by #76967
Assignees
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] lambda C++11 lambda expressions

Comments

@alexolog
Copy link

alexolog commented Jul 24, 2023

Clang 14: https://godbolt.org/z/T7vY6Ydcq OK
Clang 15: https://godbolt.org/z/cYse4o87b OK
Clang 16: https://godbolt.org/z/eoTzGe413 Boom!

Context: https://stackoverflow.com/q/76741924/181238

@EugeneZelenko EugeneZelenko added 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] lambda C++11 lambda expressions and removed new issue labels Jul 24, 2023
@EugeneZelenko
Copy link
Contributor

Also crashes in main: https://godbolt.org/z/GGMv4Kz6q

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 24, 2023

@llvm/issue-subscribers-c-20

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 24, 2023

@llvm/issue-subscribers-clang-frontend

@AaronBallman
Copy link
Collaborator

Well this is neat. When trying to reduce the test case, you can remove the include to concepts and the assert still triggers, and you can remove use of std::cout and the assert still triggers, but when you remove the include to iostreams (despite not using it anywhere in the test), the assert disappears.

https://godbolt.org/z/6n8nG99Eo

@AaronBallman AaronBallman added the concepts C++20 concepts label Jul 25, 2023
@AaronBallman
Copy link
Collaborator

For reference, the assertion is:

clang++: /root/llvm-project/clang/include/clang/AST/ExprConcepts.h:101: bool clang::ConceptSpecializationExpr::isSatisfied() const: Assertion `!isValueDependent() && "isSatisfied called on a dependent ConceptSpecializationExpr"' 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-16.0.0/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-12.2.0 -fcolor-diagnostics -fno-crash-diagnostics -DEXPLODE -std=c++20 -stdlib=libc++ -Wall -Wextra -O3 <source>
1.	<source>:41:62: current parser token ')'
2.	<source>:27:1: parsing struct/union/class body 'Thing'
3.	<source>:29:22: parsing function body 'Thing::foo'
4.	<source>:29:22: in compound statement ('{}')
5.	<source>:40:16: in compound statement ('{}')
6.	<source>:30:24: instantiating function definition 'Thing::foo(char)::(anonymous class)::operator()<&S::getS1>'
 #0 0x000055c2a782e32f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x412e32f)
 #1 0x000055c2a782c2cc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x412c2cc)
 #2 0x000055c2a7778fb8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f61642c3420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f6163d9000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f6163d6f859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f6163d6f729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f6163d80fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055c2aa4de9ad clang::Sema::BuildExprRequirement(clang::Expr*, bool, clang::SourceLocation, clang::concepts::ExprRequirement::ReturnTypeRequirement) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6dde9ad)
 #9 0x000055c2aa996e28 (anonymous namespace)::TemplateInstantiator::TransformExprRequirement(clang::concepts::ExprRequirement*) SemaTemplateInstantiate.cpp:0:0
#10 0x000055c2aa9b3cb8 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformRequiresExpr(clang::RequiresExpr*) SemaTemplateInstantiate.cpp:0:0
#11 0x000055c2aa9b511e (anonymous namespace)::TemplateInstantiator::TransformRequiresExpr(clang::RequiresExpr*) SemaTemplateInstantiate.cpp:0:0
#12 0x000055c2aa9893eb clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#13 0x000055c2aa98d948 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCondition(clang::SourceLocation, clang::VarDecl*, clang::Expr*, clang::Sema::ConditionKind) SemaTemplateInstantiate.cpp:0:0
#14 0x000055c2aa9c11af clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformIfStmt(clang::IfStmt*) SemaTemplateInstantiate.cpp:0:0
#15 0x000055c2aa9bfb39 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#16 0x000055c2aa988a57 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformLambdaExpr(clang::LambdaExpr*) SemaTemplateInstantiate.cpp:0:0
#17 0x000055c2aa98962a clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#18 0x000055c2aa98a0e8 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformInitializer(clang::Expr*, bool) (.part.0) SemaTemplateInstantiate.cpp:0:0
#19 0x000055c2aa98a46c clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformReturnStmt(clang::ReturnStmt*) SemaTemplateInstantiate.cpp:0:0
#20 0x000055c2aa9bfb39 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#21 0x000055c2aa9c517e clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x72c517e)
#22 0x000055c2aaa12d4a clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x7312d4a)
#23 0x000055c2a9ff9595 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x68f9595)
#24 0x000055c2aa90073f clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x720073f)
#25 0x000055c2aa3b361a clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*, bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6cb361a)
#26 0x000055c2aa77ac08 clang::Sema::BuildCallToMemberFunction(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x707ac08)
#27 0x000055c2aa41515d clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6d1515d)
#28 0x000055c2aa43837b clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6d3837b)
#29 0x000055c2a9f1bed9 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x681bed9)
#30 0x000055c2a9f14027 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6814027)
#31 0x000055c2a9f1710b clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x681710b)
#32 0x000055c2a9f171ad clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x68171ad)
#33 0x000055c2a9f18ebc clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6818ebc)
#34 0x000055c2a9f1b45d clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x681b45d)
#35 0x000055c2a9f95d7e clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6895d7e)
#36 0x000055c2a9f8c3ec clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688c3ec)
#37 0x000055c2a9f8d2f5 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688d2f5)
#38 0x000055c2a9f8fe58 clang::Parser::ParseStatement(clang::SourceLocation*, clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688fe58)
#39 0x000055c2a9f949c8 clang::Parser::ParseCaseStatement(clang::Parser::ParsedStmtContext, bool, clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x68949c8)
#40 0x000055c2a9f8be43 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688be43)
#41 0x000055c2a9f8d2f5 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688d2f5)
#42 0x000055c2a9f8e2ca clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688e2ca)
#43 0x000055c2a9f8e966 clang::Parser::ParseCompoundStatement(bool, unsigned int) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688e966)
#44 0x000055c2a9f8b597 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688b597)
#45 0x000055c2a9f8d2f5 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688d2f5)
#46 0x000055c2a9f8fe58 clang::Parser::ParseStatement(clang::SourceLocation*, clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688fe58)
#47 0x000055c2a9f91f0e clang::Parser::ParseSwitchStatement(clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x6891f0e)
#48 0x000055c2a9f8bcfc clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688bcfc)
#49 0x000055c2a9f8d2f5 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688d2f5)
#50 0x000055c2a9f8e2ca clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688e2ca)
#51 0x000055c2a9f8fc7a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x688fc7a)
#52 0x000055c2a9ec0d3a clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67c0d3a)
#53 0x000055c2a9ec0a1d clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67c0a1d)
#54 0x000055c2a9f0b71a clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x680b71a)
#55 0x000055c2a9f0d7dd 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-assertions-16.0.0/bin/clang+++0x680d7dd)
#56 0x000055c2a9eddd60 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67ddd60)
#57 0x000055c2a9eb3e0b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67b3e0b)
#58 0x000055c2a9eb472f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#59 0x000055c2a9eb9e89 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67b9e89)
#60 0x000055c2a9ebae2d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67bae2d)
#61 0x000055c2a9eaf1ba clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x67af1ba)
#62 0x000055c2a8bb03c8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x54b03c8)
#63 0x000055c2a841b659 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4d1b659)
#64 0x000055c2a83a21ee clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4ca21ee)
#65 0x000055c2a8502a83 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4e02a83)
#66 0x000055c2a4c592a6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x15592a6)
#67 0x000055c2a4c55397 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#68 0x000055c2a820a3b9 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
#69 0x000055c2a77794a0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x40794a0)
#70 0x000055c2a820ac6f 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
#71 0x000055c2a81d330c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4ad330c)
#72 0x000055c2a81d3d8d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4ad3d8d)
#73 0x000055c2a81dcf5c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x4adcf5c)
#74 0x000055c2a4c579f2 clang_main(int, char**) (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x15579f2)
#75 0x00007f6163d71083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#76 0x000055c2a4c5007e _start (/opt/compiler-explorer/clang-assertions-16.0.0/bin/clang+++0x155007e)
clang-16: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

@cor3ntin
Copy link
Contributor

I suspect this is one more case of trying to instantiate lambda body too early, @erichkeane is meaning to get to that at some point

@AaronBallman
Copy link
Collaborator

AaronBallman commented Jul 25, 2023

I've gotten it reduced further to:

struct S1 {
    int f1() { return 1; }
};

template <typename T>
concept C = true;

void foo() {
  auto make_caller = []<auto member> {
    return [](S1* ps) {
      if constexpr (requires { { (ps->*member)() } -> C; })
        ;
    };
  };
    
  auto* caller = make_caller.operator()<&S1::f1>();
}

https://godbolt.org/z/oKPTvPzo3

@AaronBallman AaronBallman changed the title Lambda breaks clang 16 Concept checking assertion in Clang 16 Jul 25, 2023
@alexolog
Copy link
Author

Removing the return value from the requires seems to work:
https://godbolt.org/z/6f8n9efMe

@danakj
Copy link
Contributor

danakj commented Aug 4, 2023

I have another case of this assertion here, which is concepts + partial specialization: #49570 (comment)

@danakj
Copy link
Contributor

danakj commented Aug 4, 2023

Oh ok mine is lambda related too, but the concept on the specialization somehow is needed to trigger it as well. But using a template function instead of a lambda prevents the crash there as well.

danakj added a commit to danakj/subspace that referenced this issue Aug 4, 2023
Using a lambda in a requires clause can cause clang to assert, so
move to a named function instead.

Clang bug: llvm/llvm-project#64086
danakj added a commit to danakj/subspace that referenced this issue Aug 4, 2023
Using a lambda in a requires clause can cause clang to assert, so
move to a named function instead.

Clang bug: llvm/llvm-project#64086
danakj added a commit to chromium/subspace that referenced this issue Aug 6, 2023
Using a lambda in a requires clause can cause clang to assert, so
move to a named function instead.

Clang bug: llvm/llvm-project#64086
@ecatmur
Copy link

ecatmur commented Aug 17, 2023

Looks similar to #63808

@LYP951018
Copy link
Contributor

I am trying to fix this bug. It seems that the template argument depth passed in when instantiating ReturnTypeRequirement is wrong.

@LYP951018 LYP951018 self-assigned this Dec 26, 2023
LYP951018 added a commit that referenced this issue Jan 4, 2024
…odies (#76967)

Currently, due to the incomplete implementation of p0588r1, the
instantiation of lambda expressions leads to the instantiation of the
body. And `EvaluateConstraints` is false during the instantiation of the
body, which causes crashes during the instantiation of the return type
requirement:

```cpp
template<typename T> concept doesnt_matter = true;

template<class T>
concept test = 
    []{
        return requires(T t) {
            { t } -> doesnt_matter; // crash
        };
    }();

static_assert(test<int>);
```

Although a complete implementation of p0588r1 can solve these crashes,
it will take some time. Therefore, this pull request aims to fix these
crashes first.

Fixes #63808
Fixes #64607
Fixes #64086
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] lambda C++11 lambda expressions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants