Skip to content

[clang][bytecode] Assertion `!isValueDependent() && "isSatisfied called on a dependent RequiresExpr"' failed #152899

@k-arrows

Description

@k-arrows

Reproducer:
https://godbolt.org/z/Ghq51KdbK

template <class T,
          bool = []() -> bool {
            if (requires { T::type; })
              return true;
            return false;
          }()>
struct p {
  using type = void;
};

template <class T> using P = p<T>::type;

Backtrace:

clang++: /root/llvm-project/llvm/tools/clang/include/clang/AST/ExprConcepts.h:554: bool clang::RequiresExpr::isSatisfied() const: Assertion `!isValueDependent() && "isSatisfied called on a dependent RequiresExpr"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fexperimental-new-constant-interpreter --std=c++2a <source>
1.	<source>:11:36: current parser token 'type'
 #0 0x000000000400b2d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x400b2d8)
 #1 0x0000000004008704 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4008704)
 #2 0x0000000003f4d048 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000769d9c242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000769d9c2969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000769d9c242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000769d9c2287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000769d9c22871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000769d9c239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000007dc42dd (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dc42dd)
#10 0x0000000007dec1f0 clang::interp::Compiler<clang::interp::ByteCodeEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dec1f0)
#11 0x0000000007dc5a74 clang::interp::Compiler<clang::interp::ByteCodeEmitter>::visitBool(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dc5a74)
#12 0x0000000007de995b clang::interp::Compiler<clang::interp::ByteCodeEmitter>::visitIfStmt(clang::IfStmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7de995b)
#13 0x0000000007de8cb0 clang::interp::Compiler<clang::interp::ByteCodeEmitter>::visitStmt(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7de8cb0)
#14 0x0000000007de96e4 clang::interp::Compiler<clang::interp::ByteCodeEmitter>::visitCompoundStmt(clang::CompoundStmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7de96e4)
#15 0x0000000007de8d10 clang::interp::Compiler<clang::interp::ByteCodeEmitter>::visitStmt(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7de8d10)
#16 0x0000000007debed7 clang::interp::Compiler<clang::interp::ByteCodeEmitter>::visitFunc(clang::FunctionDecl const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7debed7)
#17 0x0000000007dbe15a clang::interp::ByteCodeEmitter::compileFunc(clang::FunctionDecl const*, clang::interp::Function*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dbe15a)
#18 0x0000000007aef43a clang::interp::compileFunction(clang::interp::InterpState&, clang::interp::Function const*) Interp.cpp:0:0
#19 0x0000000007b70b6b clang::interp::Call(clang::interp::InterpState&, clang::interp::CodePtr, clang::interp::Function const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7b70b6b)
#20 0x0000000007e019a8 clang::interp::Compiler<clang::interp::EvalEmitter>::VisitCallExpr(clang::CallExpr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e019a8)
#21 0x0000000007e07170 clang::interp::Compiler<clang::interp::EvalEmitter>::visit(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7e07170)
#22 0x0000000007dfc1ca clang::interp::Compiler<clang::interp::EvalEmitter>::visitExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7dfc1ca)
#23 0x0000000007994171 clang::interp::EvalEmitter::interpretExpr(clang::Expr const*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7994171)
#24 0x0000000007987b14 clang::interp::Context::evaluate(clang::interp::State&, clang::Expr const*, clang::APValue&, clang::Expr::ConstantExprKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7987b14)
#25 0x0000000007960175 clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::ConstantExprKind) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7960175)
#26 0x0000000006f67fa5 clang::Sema::EvaluateConvertedConstantExpression(clang::Expr*, clang::QualType, clang::APValue&, clang::CCEKind, bool, clang::APValue const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f67fa5)
#27 0x0000000007083e5d clang::Sema::CheckTemplateArgument(clang::NamedDecl*, clang::QualType, clang::Expr*, clang::TemplateArgument&, clang::TemplateArgument&, bool, clang::Sema::CheckTemplateArgumentKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7083e5d)
#28 0x0000000007085fa3 clang::Sema::CheckTemplateArgument(clang::NamedDecl*, clang::TemplateArgumentLoc&, clang::NamedDecl*, clang::SourceLocation, clang::SourceLocation, unsigned int, clang::Sema::CheckTemplateArgumentInfo&, clang::Sema::CheckTemplateArgumentKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7085fa3)
#29 0x000000000708a2b2 clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, clang::DefaultArguments const&, bool, clang::Sema::CheckTemplateArgumentInfo&, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x708a2b2)
#30 0x00000000070947ca clang::Sema::CheckTemplateIdType(clang::ElaboratedTypeKeyword, clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x70947ca)
#31 0x00000000068d1b9b clang::Sema::ActOnCXXNestedNameSpecifier(clang::Scope*, clang::CXXScopeSpec&, clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation, clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation, clang::SourceLocation, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68d1b9b)
#32 0x00000000067441da clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool, clang::IdentifierInfo const**, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67441da)
#33 0x00000000066afebc clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66afebc)
#34 0x00000000066f6eff clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f6eff)
#35 0x00000000066f8375 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f8375)
#36 0x00000000066ff19d clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66ff19d)
#37 0x000000000670d1b4 clang::Parser::ParseAliasDeclarationAfterDeclarator(clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::Parser::UsingDeclarator&, clang::SourceLocation&, clang::AccessSpecifier, clang::ParsedAttributes&, clang::Decl**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x670d1b4)
#38 0x0000000006718133 clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6718133)
#39 0x0000000006718f05 clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6718f05)
#40 0x00000000067d1fe2 clang::Parser::ParseDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67d1fe2)
#41 0x00000000067df449 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (.part.0) ParseTemplate.cpp:0:0
#42 0x00000000067df85a clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67df85a)
#43 0x00000000066fbcf0 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66fbcf0)
#44 0x00000000066b87a7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66b87a7)
#45 0x00000000066b9675 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66b9675)
#46 0x00000000066ab87a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66ab87a)
#47 0x00000000049b0d28 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49b0d28)
#48 0x0000000004ca5115 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ca5115)
#49 0x0000000004c2144e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c2144e)
#50 0x0000000004d96861 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d96861)
#51 0x0000000000daf00f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdaf00f)
#52 0x0000000000da5cba ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#53 0x0000000004a18669 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
#54 0x0000000003f4d4e4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f4d4e4)
#55 0x0000000004a18c7f 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
#56 0x00000000049daf1d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49daf1d)
#57 0x00000000049dbfae clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49dbfae)
#58 0x00000000049e39f5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49e39f5)
#59 0x0000000000dab4c5 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdab4c5)
#60 0x0000000000c5f554 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc5f554)
#61 0x0000769d9c229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#62 0x0000769d9c229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#63 0x0000000000da5765 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda5765)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++20clang:bytecodeIssues for the clang bytecode constexpr interpreterclang:frontendLanguage frontend issues, e.g. anything involving "Sema"crashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions