| Issue |
175426
|
| Summary |
[Clang] Assertion `IsExpectedEntity(FD1) && FD2 && IsExpectedEntity(FD2) && "use non-instantiated function declaration for constraints partial " "ordering"` failed.
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
Xniao
|
***Generated by fuzzer.***
Clang assertions trunk crashed and goes back to 19.1 with `-std=c++20` flag.
Compiler Explorer: https://godbolt.org/z/acrvxh4Kn
However, the original test case goes back to 11.0.
When I reduce the code the crash disappear.
Here is the full code: https://godbolt.org/z/bn69eY74e
## Program
```cpp
template <typename T1> auto fwd2(const T1 &t1) {
return [](auto &&...ts1) {
struct LocalType {
int data;
auto operator<=>(const LocalType &other) const = default;
};
LocalType x{42}, y{42};
static_assert(noexcept(x < y), "Noexcept check failed");
}();
}
int main() { return fwd2(1); }
```
## Stack Dump
```bash
<source>:5:7: error: cannot default 'operator<=>' because type 'std::strong_ordering' was not found; include <compare>
5 | auto operator<=>(const LocalType &other) const = default;
| ^
<source>:3:12: note: in instantiation of member class 'LocalType' requested here
3 | struct LocalType {
| ^
<source>:2:10: note: in instantiation of function template specialization 'fwd2(const int &)::(lambda)::operator()<>' requested here
2 | return [](auto &&...ts1) {
| ^
<source>:12:21: note: in instantiation of function template specialization 'fwd2<int>' requested here
12 | int main() { return fwd2(1); }
| ^
clang++: /root/llvm-project/llvm/tools/clang/lib/Sema/SemaConcept.cpp:2470: bool clang::Sema::IsAtLeastAsConstrained(const clang::NamedDecl*, llvm::MutableArrayRef<clang::AssociatedConstraint>, const clang::NamedDecl*, llvm::MutableArrayRef<clang::AssociatedConstraint>, bool&): Assertion `IsExpectedEntity(FD1) && FD2 && IsExpectedEntity(FD2) && "use non-instantiated function declaration for constraints partial " "ordering"' 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++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1. <source>:12:27: current parser token ')'
2. <source>:12:12: parsing function body 'main'
3. <source>:12:12: in compound statement ('{}')
4. <source>:1:29: instantiating function definition 'fwd2<int>'
5. <source>:2:10: instantiating function definition 'fwd2(const int &)::(lambda)::operator()<>'
#0 0x0000000004309158 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4309158)
#1 0x0000000004306584 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4306584)
#2 0x00000000042492d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000070b985242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000070b9852969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000070b985242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000070b9852287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000070b98522871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000070b985239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000006d52e5c clang::Sema::IsAtLeastAsConstrained(clang::NamedDecl const*, llvm::MutableArrayRef<clang::AssociatedConstraint>, clang::NamedDecl const*, llvm::MutableArrayRef<clang::AssociatedConstraint>, bool&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6d52e5c)
#10 0x00000000074c5b93 clang::Sema::getMoreConstrainedFunction(clang::FunctionDecl*, clang::FunctionDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x74c5b93)
#11 0x0000000007335f36 clang::isBetterOverloadCandidate(clang::Sema&, clang::OverloadCandidate const&, clang::OverloadCandidate const&, clang::SourceLocation, clang::OverloadCandidateSet::CandidateSetKind, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7335f36)
#12 0x000000000733ee0c clang::OverloadCandidateSet::BestViableFunctionImpl(clang::Sema&, clang::SourceLocation, clang::OverloadCandidate*&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x733ee0c)
#13 0x0000000007359b14 clang::OverloadCandidateSet::BestViableFunction(clang::Sema&, clang::SourceLocation, clang::OverloadCandidate*&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7359b14)
#14 0x00000000073745f9 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x73745f9)
#15 0x0000000006f77622 BuildOverloadedBinOp(clang::Sema&, clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) SemaExpr.cpp:0:0
#16 0x0000000006fcd9c7 clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fcd9c7)
#17 0x00000000075b6787 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*) SemaTemplateInstantiate.cpp:0:0
#18 0x0000000007595e6c clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#19 0x000000000759f5da clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXNoexceptExpr(clang::CXXNoexceptExpr*) SemaTemplateInstantiate.cpp:0:0
#20 0x0000000007596049 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#21 0x00000000075d0307 clang::Sema::SubstExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x75d0307)
#22 0x000000000761fede clang::TemplateDeclInstantiator::VisitStaticAssertDecl(clang::StaticAssertDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x761fede)
#23 0x0000000007687634 void llvm::function_ref<void ()>::callback_fn<clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&)::'lambda'()>(long) SemaTemplateInstantiateDecl.cpp:0:0
#24 0x0000000008537151 clang::StackExhaustionHandler::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8537151)
#25 0x000000000762198a clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x762198a)
#26 0x000000000758bcaa clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformDeclStmt(clang::DeclStmt*) SemaTemplateInstantiate.cpp:0:0
#27 0x00000000075d39c5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#28 0x00000000075dcdfd clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x75dcdfd)
#29 0x0000000007679130 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7679130)
#30 0x0000000008537151 clang::StackExhaustionHandler::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8537151)
#31 0x00000000074ce712 clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x74ce712)
#32 0x0000000006f836e3 clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f836e3)
#33 0x0000000007333ee7 CreateFunctionRefExpr(clang::Sema&, clang::FunctionDecl*, clang::NamedDecl*, clang::Expr const*, bool, clang::SourceLocation, clang::DeclarationNameLoc const&) SemaOverload.cpp:0:0
#34 0x00000000073794e8 clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x73794e8)
#35 0x0000000006fd1424 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fd1424)
#36 0x0000000006fd637c clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fd637c)
#37 0x00000000075b9413 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) SemaTemplateInstantiate.cpp:0:0
#38 0x0000000007596108 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#39 0x00000000075b5e75 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformInitializer(clang::Expr*, bool) (.part.0) SemaTemplateInstantiate.cpp:0:0
#40 0x00000000075b61fc clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformReturnStmt(clang::ReturnStmt*) SemaTemplateInstantiate.cpp:0:0
#41 0x00000000075d39c5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) SemaTemplateInstantiate.cpp:0:0
#42 0x00000000075dcdfd clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x75dcdfd)
#43 0x0000000007679130 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7679130)
#44 0x0000000008537151 clang::StackExhaustionHandler::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8537151)
#45 0x00000000074ce712 clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x74ce712)
#46 0x0000000006f836e3 clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f836e3)
#47 0x0000000007371f14 FinishOverloadedCallExpr(clang::Sema&, clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, clang::OverloadCandidateSet*, clang::OverloadCandidate**, clang::OverloadingResult, bool) SemaOverload.cpp:0:0
#48 0x0000000007372dc0 clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7372dc0)
#49 0x0000000006fd0e6a clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fd0e6a)
#50 0x0000000006fd637c clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fd637c)
#51 0x0000000006ad4037 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ad4037)
#52 0x0000000006accf4a clang::Parser::ParseCastExpression(clang::CastParseKind, bool, bool&, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6accf4a)
#53 0x0000000006acf1a7 clang::Parser::ParseCastExpression(clang::CastParseKind, bool, clang::TypoCorrectionTypeBehavior, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6acf1a7)
#54 0x0000000006acf239 clang::Parser::ParseAssignmentExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6acf239)
#55 0x0000000006ad3819 clang::Parser::ParseExpression(clang::TypoCorrectionTypeBehavior) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ad3819)
#56 0x0000000006b4bbe5 clang::Parser::ParseReturnStatement() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b4bbe5)
#57 0x0000000006b5005d clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b5005d)
#58 0x0000000006b50f76 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 24u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b50f76)
#59 0x0000000006b598be clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b598be)
#60 0x0000000006b5a10a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b5a10a)
#61 0x0000000006a6055b clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a6055b)
#62 0x0000000006a969cd 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+++0x6a969cd)
#63 0x0000000006a536bb clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a536bb)
#64 0x0000000006a53eaf clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a53eaf)
#65 0x0000000006a5bcda cl<truncated>Please see the issue for the entire body.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs