[llvm-bugs] [Bug 46391] New: Assertion failure in requires clause while doing overload resolution
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 18 14:07:27 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46391
Bug ID: 46391
Summary: Assertion failure in requires clause while doing
overload resolution
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: david at doublewise.net
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
Compiling the following code
```
struct constrained;
template<typename T>
struct type {
};
template<typename T>
constexpr bool f(type<T>) {
return true;
}
template<typename T>
concept matches = f(type<T>());
struct constrained {
template<typename U> requires matches<U>
explicit constrained(U value) {
}
};
bool f(constrained const &) {
return true;
}
struct outer {
constrained state;
};
bool f(outer const & x) {
return f(x.state);
}
```
crashes with
```
clang++: /home/david/llvm/llvm/include/llvm/ADT/FoldingSet.h:479: void
llvm::FoldingSetImpl<Derived, T>::InsertNode(T*) [with Derived =
llvm::ContextualFoldingSet<clang::ConstraintSatisfaction, const
clang::ASTContext&>; T = clang::ConstraintSatisfaction]: Assertion `Inserted ==
N && "Node already inserted!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/david/llvm/build/bin/clang++ -std=c++20 -o
/dev/null -c requires-clause-overload.cpp
1. requires-clause-overload.cpp:30:18: current parser token ')'
2. requires-clause-overload.cpp:29:25: parsing function body 'f'
3. requires-clause-overload.cpp:29:25: in compound statement ('{}')
#0 0x000056014946a7ea llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/david/llvm/build/bin/clang+++0x1d307ea)
#1 0x00005601494685a4 llvm::sys::RunSignalHandlers()
(/home/david/llvm/build/bin/clang+++0x1d2e5a4)
#2 0x00005601493d9488 CrashRecoverySignalHandler(int)
(/home/david/llvm/build/bin/clang+++0x1c9f488)
#3 0x00007f5bbb8db960 __restore_rt (/usr/lib/libpthread.so.0+0x14960)
#4 0x00007f5bbb362355 raise (/usr/lib/libc.so.6+0x3c355)
#5 0x00007f5bbb34b853 abort (/usr/lib/libc.so.6+0x25853)
#6 0x00007f5bbb34b727 _nl_load_domain.cold (/usr/lib/libc.so.6+0x25727)
#7 0x00007f5bbb35a936 (/usr/lib/libc.so.6+0x34936)
#8 0x000056014b4aedc3
clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*,
llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceRange, clang::ConstraintSatisfaction&)
(/home/david/llvm/build/bin/clang+++0x3d74dc3)
#9 0x000056014ba0ac01 clang::Sema::CheckConceptTemplateId(clang::CXXScopeSpec
const&, clang::SourceLocation, clang::DeclarationNameInfo const&,
clang::NamedDecl*, clang::ConceptDecl*, clang::TemplateArgumentListInfo const*)
(/home/david/llvm/build/bin/clang+++0x42d0c01)
#10 0x000056014bb16b44 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformConceptSpecializationExpr(clang::ConceptSpecializationExpr*)
(/home/david/llvm/build/bin/clang+++0x43dcb44)
#11 0x000056014bb02fbf clang::Sema::SubstExpr(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&)
(/home/david/llvm/build/bin/clang+++0x43c8fbf)
#12 0x000056014b4aceca bool
calculateConstraintSatisfaction<calculateConstraintSatisfaction(clang::Sema&,
clang::NamedDecl const*, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceLocation, clang::MultiLevelTemplateArgumentList&, clang::Expr
const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr
const*)>(clang::Sema&, clang::Expr const*, clang::ConstraintSatisfaction&,
calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*,
llvm::ArrayRef<clang::TemplateArgument>, clang::SourceLocation,
clang::MultiLevelTemplateArgumentList&, clang::Expr const*,
clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)&&)
(/home/david/llvm/build/bin/clang+++0x3d72eca)
#13 0x000056014b4aec9e
clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*,
llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceRange, clang::ConstraintSatisfaction&)
(/home/david/llvm/build/bin/clang+++0x3d74c9e)
#14 0x000056014bb343f9
clang::Sema::CheckInstantiatedFunctionTemplateConstraints(clang::SourceLocation,
clang::FunctionDecl*, llvm::ArrayRef<clang::TemplateArgument>,
clang::ConstraintSatisfaction&) (/home/david/llvm/build/bin/clang+++0x43fa3f9)
#15 0x000056014bac9adb
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 ()>) (/home/david/llvm/build/bin/clang+++0x438fadb)
#16 0x000056014bae2eac
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>)>)
(/home/david/llvm/build/bin/clang+++0x43a8eac)
#17 0x000056014b964471
clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::TemplateArgumentListInfo*,
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool,
clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder)
(/home/david/llvm/build/bin/clang+++0x422a471)
#18 0x000056014b86e6c9 clang::Sema::LookupSpecialMember(clang::CXXRecordDecl*,
clang::Sema::CXXSpecialMember, bool, bool, bool, bool, bool)
(/home/david/llvm/build/bin/clang+++0x41346c9)
#19 0x000056014b5e837f defaultedSpecialMemberIsConstexpr(clang::Sema&,
clang::CXXRecordDecl*, clang::Sema::CXXSpecialMember, bool,
clang::CXXConstructorDecl*, clang::Sema::InheritedConstructorInfo*)
(/home/david/llvm/build/bin/clang+++0x3eae37f)
#20 0x000056014b5ef917
clang::Sema::DeclareImplicitCopyConstructor(clang::CXXRecordDecl*)
(/home/david/llvm/build/bin/clang+++0x3eb5917)
#21 0x000056014b847d87 void llvm::function_ref<void
()>::callback_fn<clang::Sema::LookupConstructors(clang::CXXRecordDecl*)::'lambda'()>(long)
(/home/david/llvm/build/bin/clang+++0x410dd87)
#22 0x000056014b39c9e1
clang::Sema::runWithSufficientStackSpace(clang::SourceLocation,
llvm::function_ref<void ()>) (/home/david/llvm/build/bin/clang+++0x3c629e1)
#23 0x000056014b8484d3 clang::Sema::LookupConstructors(clang::CXXRecordDecl*)
(/home/david/llvm/build/bin/clang+++0x410e4d3)
#24 0x000056014b964eae IsUserDefinedConversion(clang::Sema&, clang::Expr*,
clang::QualType, clang::UserDefinedConversionSequence&,
clang::OverloadCandidateSet&, clang::Sema::AllowedExplicit, bool)
(/home/david/llvm/build/bin/clang+++0x422aeae)
#25 0x000056014b965a5a TryUserDefinedConversion(clang::Sema&, clang::Expr*,
clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool)
(.constprop.0) (/home/david/llvm/build/bin/clang+++0x422ba5a)
#26 0x000056014b9660a6 TryImplicitConversion(clang::Sema&, clang::Expr*,
clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool)
(/home/david/llvm/build/bin/clang+++0x422c0a6)
#27 0x000056014b96076f TryReferenceInit(clang::Sema&, clang::Expr*,
clang::QualType, clang::SourceLocation, bool, bool)
(/home/david/llvm/build/bin/clang+++0x422676f)
#28 0x000056014b9619f7 TryCopyInitialization(clang::Sema&, clang::Expr*,
clang::QualType, bool, bool, bool, bool)
(/home/david/llvm/build/bin/clang+++0x42279f7)
#29 0x000056014b9639e8 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)
(/home/david/llvm/build/bin/clang+++0x42299e8)
#30 0x000056014b969274
clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*,
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)
(/home/david/llvm/build/bin/clang+++0x422f274)
#31 0x000056014b9695cc clang::Sema::buildOverloadedCallSet(clang::Scope*,
clang::Expr*, clang::UnresolvedLookupExpr*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
clang::OverloadCandidateSet*, clang::ActionResult<clang::Expr*, true>*)
(/home/david/llvm/build/bin/clang+++0x422f5cc)
#32 0x000056014b9731e5 clang::Sema::BuildOverloadedCallExpr(clang::Scope*,
clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool,
bool) (/home/david/llvm/build/bin/clang+++0x42391e5)
#33 0x000056014b6ca4cc clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool)
(/home/david/llvm/build/bin/clang+++0x3f904cc)
#34 0x000056014b6cb0cc clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*)
(/home/david/llvm/build/bin/clang+++0x3f910cc)
#35 0x000056014b301cab
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) (.localalias) (/home/david/llvm/build/bin/clang+++0x3bc7cab)
#36 0x000056014b2fb9f0
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*) (.localalias)
(/home/david/llvm/build/bin/clang+++0x3bc19f0)
#37 0x000056014b2fe437
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool,
clang::Parser::TypeCastState, bool, bool*)
(/home/david/llvm/build/bin/clang+++0x3bc4437)
#38 0x000056014b2ffe05
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/home/david/llvm/build/bin/clang+++0x3bc5e05)
#39 0x000056014b300cb9
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/home/david/llvm/build/bin/clang+++0x3bc6cb9)
#40 0x000056014b352244 clang::Parser::ParseReturnStatement()
(/home/david/llvm/build/bin/clang+++0x3c18244)
#41 0x000056014b3544e9
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/home/david/llvm/build/bin/clang+++0x3c1a4e9)
#42 0x000056014b354a7e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/home/david/llvm/build/bin/clang+++0x3c1aa7e)
#43 0x000056014b35922a clang::Parser::ParseCompoundStatementBody(bool)
(/home/david/llvm/build/bin/clang+++0x3c1f22a)
#44 0x000056014b35bc60 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/home/david/llvm/build/bin/clang+++0x3c21c60)
#45 0x000056014b2b4972
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/home/david/llvm/build/bin/clang+++0x3b7a972)
#46 0x000056014b2da027 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/david/llvm/build/bin/clang+++0x3ba0027)
#47 0x000056014b2b0432
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0)
(/home/david/llvm/build/bin/clang+++0x3b76432)
#48 0x000056014b2b6306
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (.localalias)
(/home/david/llvm/build/bin/clang+++0x3b7c306)
#49 0x000056014b2b6ca8
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/david/llvm/build/bin/clang+++0x3b7cca8)
#50 0x000056014b2a9b89 clang::ParseAST(clang::Sema&, bool, bool)
(/home/david/llvm/build/bin/clang+++0x3b6fb89)
#51 0x0000560149d2d089 clang::FrontendAction::Execute()
(/home/david/llvm/build/bin/clang+++0x25f3089)
#52 0x0000560149ce89d6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/david/llvm/build/bin/clang+++0x25ae9d6)
#53 0x0000560149df2c53
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/david/llvm/build/bin/clang+++0x26b8c53)
#54 0x000056014823b432 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/david/llvm/build/bin/clang+++0xb01432)
#55 0x0000560148237730 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/david/llvm/build/bin/clang+++0xafd730)
#56 0x0000560149badf25 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()>(long)
(/home/david/llvm/build/bin/clang+++0x2473f25)
#57 0x00005601493d9614
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/david/llvm/build/bin/clang+++0x1c9f614)
#58 0x0000560149baece2
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (.part.0)
(/home/david/llvm/build/bin/clang+++0x2474ce2)
#59 0x0000560149b84f78
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/david/llvm/build/bin/clang+++0x244af78)
#60 0x0000560149b85936
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/david/llvm/build/bin/clang+++0x244b936)
#61 0x0000560149b8f1e1
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/david/llvm/build/bin/clang+++0x24551e1)
#62 0x00005601481b640e main (/home/david/llvm/build/bin/clang+++0xa7c40e)
#63 0x00007f5bbb34d002 __libc_start_main (/usr/lib/libc.so.6+0x27002)
#64 0x0000560148236dde _start (/home/david/llvm/build/bin/clang+++0xafcdde)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
6c45532908bacc0cf569bcad74f6e04e1e2a6c61)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/david/llvm/build/bin
clang-11: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/requires-clause-overload-d6db19.cpp
clang-11: note: diagnostic msg: /tmp/requires-clause-overload-d6db19.sh
clang-11: note: diagnostic msg:
********************
```
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200618/b1c69194/attachment-0001.html>
More information about the llvm-bugs
mailing list