[Clang] ICE at clang::Expr::EvaluateAsConstantExpr() #62362
Closed
Description
clang: ../../clang/lib/AST/ExprConstant.cpp:15331: bool clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult &, const clang::ASTContext &, clang::Expr::ConstantExprKind) const: Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' failed.ICE Error Output
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: /home/test/Documents/oss/llvm-project/out/gn/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -main-file-name hpack.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/tmp -resource-dir /home/test/Documents/oss/llvm-project/out/gn/lib/clang/17 -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1 -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/x86_64-pc-linux-gnu -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/backward -internal-isystem /home/test/Documents/oss/llvm-project/out/gn/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++20 -fdeprecated-macro -fdebug-compilation-dir=/tmp -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/hpack-1654b4.o -x c++ hpack.cpp
1. hpack.cpp:17:17: current parser token ';'
2. hpack.cpp:16:12: parsing function body 'foo'
3. hpack.cpp:16:12: in compound statement ('{}')
#0 0x000055c8c16a6992 PrintStackTraceSignalHandler(void*) (.llvm.15242681962188963970) Signals.cpp:0:0
#1 0x000055c8c16a43d0 llvm::sys::RunSignalHandlers() (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x3a673d0)
#2 0x000055c8c16a6d3d SignalHandler(int) Signals.cpp:0:0
#3 0x00007fcd7fd69f50 (/usr/lib/libc.so.6+0x38f50)
#4 0x00007fcd7fdb88ec (/usr/lib/libc.so.6+0x878ec)
#5 0x00007fcd7fd69ea8 raise (/usr/lib/libc.so.6+0x38ea8)
#6 0x00007fcd7fd5353d abort (/usr/lib/libc.so.6+0x2253d)
#7 0x00007fcd7fd5345c (/usr/lib/libc.so.6+0x2245c)
#8 0x00007fcd7fd629f6 (/usr/lib/libc.so.6+0x319f6)
#9 0x000055c8c1f7ec6f clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::ConstantExprKind) const (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4341c6f)
#10 0x000055c8c295748e clang::ActionResult<clang::Expr*, true> calculateConstraintSatisfaction<calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::$_7>(clang::Sema&, clang::Expr const*, clang::ConstraintSatisfaction&, calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::$_7&&) SemaConcept.cpp:0:0
#11 0x000055c8c295072e CheckConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) SemaConcept.cpp:0:0
#12 0x000055c8c295024b clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4d1324b)
#13 0x000055c8c29524af clang::Sema::CheckFunctionConstraints(clang::FunctionDecl const*, clang::ConstraintSatisfaction&, clang::SourceLocation, bool) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4d154af)
#14 0x000055c8c2be68f7 clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*, bool) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4fa98f7)
#15 0x000055c8c2e874c2 PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) SemaInit.cpp:0:0
#16 0x000055c8c2e801ef clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x52431ef)
#17 0x000055c8c2d849c6 clang::Sema::BuildCXXTypeConstructExpr(clang::TypeSourceInfo*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, bool) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x51479c6)
#18 0x000055c8c2d83def clang::Sema::ActOnCXXTypeConstructExpr(clang::OpaquePtr<clang::QualType>, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, bool) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x5146def)
#19 0x000055c8c260463c clang::Parser::ParseCXXTypeConstructExpression(clang::DeclSpec const&) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x49c763c)
#20 0x000055c8c25aa9be clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x496d9be)
#21 0x000055c8c25a3bf4 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4966bf4)
#22 0x000055c8c2639317 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) ParseStmt.cpp:0:0
#23 0x000055c8c2638962 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x49fb962)
#24 0x000055c8c26440c3 clang::Parser::ParseCompoundStatementBody(bool) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4a070c3)
#25 0x000055c8c2644fd0 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4a07fd0)
#26 0x000055c8c2584332 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4947332)
#27 0x000055c8c25d7f43 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x499af43)
#28 0x000055c8c2581d9d clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4944d9d)
#29 0x000055c8c258157c clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x494457c)
#30 0x000055c8c2580274 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4943274)
#31 0x000055c8c257e132 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x4941132)
#32 0x000055c8c2578afe clang::ParseAST(clang::Sema&, bool, bool) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x493bafe)
#33 0x000055c8c0a331e5 clang::CodeGenAction::ExecuteAction() (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x2df61e5)
#34 0x000055c8c09474dd clang::FrontendAction::Execute() (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x2d0a4dd)
#35 0x000055c8c089c30f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x2c5f30f)
#36 0x000055c8c0a2e5dc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x2df15dc)
#37 0x000055c8bff75825 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x2338825)
#38 0x000055c8bff898ad ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#39 0x000055c8bff87d4f clang_main(int, char**, llvm::ToolContext const&) (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x234ad4f)
#40 0x000055c8bff8bb32 main (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x234eb32)
#41 0x00007fcd7fd54790 (/usr/lib/libc.so.6+0x23790)
#42 0x00007fcd7fd5484a __libc_start_main (/usr/lib/libc.so.6+0x2384a)
#43 0x000055c8bff74a85 _start (/home/test/Documents/oss/llvm-project/out/gn/bin/clang+0x2337a85)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 17.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/test//Documents/oss/llvm-project/out/gn/binTriggered by:
template <typename T, typename U> inline constexpr bool IsSame = false;
template <typename T> inline constexpr bool IsSame<T, T> = true;
struct Empty {};
template <typename T> struct Test {
Test()
requires(IsSame<T, Empty>);
};
template <>
struct Test<void> : public Test<Empty> {
using Test<Empty>::Test;
};
void foo() {
Test<void>();
}(while reducing code for #62361, might be related)
Activity