llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.78k stars 11.44k forks source link

Clang-16 frontend command failed with exit code 139 #62344

Closed anders-wind closed 1 year ago

anders-wind commented 1 year ago

Hi! I'm experiencing a crash when I'm compiling our stronk project with Clang 16. The code compiles just fine with Clang 15. I don't know whats causing the issue, but please let me know if I can supply any additional resources.

The compiler output:

/home/anderswind/projects/stronk/tests/src/unit_tests.cpp:108:30: note: in instantiation of template type alias 'multiply_t' requested here
static_assert(std::is_same_v<multiply_t<Distance, Time>, NewUnitType<double, UnitTypeLists<TypeList<Distance, Time>, TypeList<>>>>);
                             ^
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: /usr/bin/clang++-16 -I/home/anderswind/projects/stronk/include -isystem /home/anderswind/projects/stronk/build/vcpkg_installed/x64-linux/include -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wshadow -Wformat=2 -Wundef -Werror=float-equal -Wno-gnu-zero-variadic-macro-arguments -O3 -DNDEBUG -std=c++20 -MD -MT tests/CMakeFiles/stronk_test.dir/src/unit_tests.cpp.o -MF CMakeFiles/stronk_test.dir/src/unit_tests.cpp.o.d -o CMakeFiles/stronk_test.dir/src/unit_tests.cpp.o -c /home/anderswind/projects/stronk/tests/src/unit_tests.cpp
1.      /home/anderswind/projects/stronk/tests/src/unit_tests.cpp:134:13 <Spelling=/home/anderswind/projects/stronk/build/vcpkg_installed/x64-linux/include/gtest/gtest_pred_impl.h:134:41>: current parser token ','
2.      /home/anderswind/projects/stronk/tests/src/unit_tests.cpp:10:1: parsing namespace 'twig'
3.      /home/anderswind/projects/stronk/tests/src/unit_tests.cpp:131:1: parsing function body 'twig::unit_tests::stronk_units_when_multiplied_with_own_type_the_value_in_the_resulting_type_behaves_as_if_it_the_values_were_multiplied_Test::TestBody'
4.      /home/anderswind/projects/stronk/tests/src/unit_tests.cpp:131:1: in compound statement ('{}')
5.      /home/anderswind/projects/stronk/tests/src/unit_tests.cpp:132:37: in compound statement ('{}')
6.      /home/anderswind/projects/stronk/tests/src/unit_tests.cpp:133:41: in compound statement ('{}')
 #0 0x00007ff550f73546 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfbb546)
 #1 0x00007ff550f716e0 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xfb96e0)
 #2 0x00007ff550eb1f30 (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xef9f30)
 #3 0x00007ff54fa90520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007ff55847e188 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xed5188)
 #5 0x00007ff558457a28 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xeaea28)
 #6 0x00007ff558453b04 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xeaab04)
 #7 0x00007ff5584535e9 clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::ConstantExprKind) const (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xeaa5e9)
 #8 0x00007ff558a0e9a3 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x14659a3)
 #9 0x00007ff558a09b5f (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1460b5f)
#10 0x00007ff558a0950c clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x146050c)
#11 0x00007ff558a0ac2b clang::Sema::CheckFunctionConstraints(clang::FunctionDecl const*, clang::ConstraintSatisfaction&, clang::SourceLocation, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x1461c2b)
#12 0x00007ff558b8bb54 clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x15e2b54)
#13 0x00007ff558d52bf0 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x17a9bf0)
#14 0x00007ff558d4e4ce clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x17a54ce)
#15 0x00007ff558ca6970 clang::Sema::BuildCXXTypeConstructExpr(clang::TypeSourceInfo*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x16fd970)
#16 0x00007ff558ca5f83 clang::Sema::ActOnCXXTypeConstructExpr(clang::OpaquePtr<clang::QualType>, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x16fcf83)
#17 0x00007ff5581d1969 clang::Parser::ParseCXXTypeConstructExpression(clang::DeclSpec const&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc28969)
#18 0x00007ff5581bf688 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc16688)
#19 0x00007ff5581c03c3 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc173c3)
#20 0x00007ff5581b9ad1 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc10ad1)
#21 0x00007ff5581c5b5a clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&, llvm::function_ref<void ()>, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc1cb5a)
#22 0x00007ff5581bc7fc clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc137fc)
#23 0x00007ff5581bd855 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc14855)
#24 0x00007ff5581b9ad1 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc10ad1)
#25 0x00007ff5581c1a1c clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc18a1c)
#26 0x00007ff5581bffc1 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc16fc1)
#27 0x00007ff5581b9ad1 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc10ad1)
#28 0x00007ff5581d285d clang::Parser::ParseCXXCondition(clang::ActionResult<clang::Stmt*, true>*, clang::SourceLocation, clang::Sema::ConditionKind, bool, clang::Parser::ForRangeInfo*, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc2985d)
#29 0x00007ff55821fab3 clang::Parser::ParseParenExprOrCondition(clang::ActionResult<clang::Stmt*, true>*, clang::Sema::ConditionResult&, clang::SourceLocation, clang::Sema::ConditionKind, clang::SourceLocation&, clang::SourceLocation&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc76ab3)
#30 0x00007ff55821a048 clang::Parser::ParseIfStatement(clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc71048)
#31 0x00007ff558217b7f clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6eb7f)
#32 0x00007ff558216d4d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6dd4d)
#33 0x00007ff558219ae0 clang::Parser::ParseDefaultStatement(clang::Parser::ParsedStmtContext) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc70ae0)
#34 0x00007ff55821815f clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6f15f)
#35 0x00007ff558216d4d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6dd4d)
#36 0x00007ff5582196e0 clang::Parser::ParseCaseStatement(clang::Parser::ParsedStmtContext, bool, clang::ActionResult<clang::Expr*, true>) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc706e0)
#37 0x00007ff558217b6a clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6eb6a)
#38 0x00007ff558216d4d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6dd4d)
#39 0x00007ff55821abf0 clang::Parser::ParseSwitchStatement(clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc71bf0)
#40 0x00007ff558217b94 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6eb94)
#41 0x00007ff558216d4d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6dd4d)
#42 0x00007ff55821f1e0 clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc761e0)
#43 0x00007ff5582180da clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6f0da)
#44 0x00007ff558216d4d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6dd4d)
#45 0x00007ff55821c7f0 clang::Parser::ParseForStatement(clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc737f0)
#46 0x00007ff5582179b2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6e9b2)
#47 0x00007ff558216d4d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6dd4d)
#48 0x00007ff55821f1e0 clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc761e0)
#49 0x00007ff5582180da clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6f0da)
#50 0x00007ff558216d4d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6dd4d)
#51 0x00007ff55821c7f0 clang::Parser::ParseForStatement(clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc737f0)
#52 0x00007ff5582179b2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6e9b2)
#53 0x00007ff558216d4d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc6dd4d)
#54 0x00007ff55821f1e0 clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc761e0)
#55 0x00007ff55822029f clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc7729f)
#56 0x00007ff55823a400 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc91400)
#57 0x00007ff55818a322 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbe1322)
#58 0x00007ff558239537 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc90537)
#59 0x00007ff558238f59 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc8ff59)
#60 0x00007ff5582381f7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc8f1f7)
#61 0x00007ff5581a3b4d clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbfab4d)
#62 0x00007ff5581a3c5c clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbfac5c)
#63 0x00007ff5581a34ee clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbfa4ee)
#64 0x00007ff5581885d1 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbdf5d1)
#65 0x00007ff558237b15 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc8eb15)
#66 0x00007ff55823659e clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xc8d59e)
#67 0x00007ff55817624e clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0xbcd24e)
#68 0x00007ff559d8e525 clang::FrontendAction::Execute() (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x27e5525)
#69 0x00007ff559d0b714 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2762714)
#70 0x00007ff559e06fa4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x285dfa4)
#71 0x000055dfc831dd9c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang++-16+0x14d9c)
#72 0x000055dfc831b040 (/usr/bin/clang++-16+0x12040)
#73 0x00007ff5599e81a2 (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x243f1a2)
#74 0x00007ff550eb1ccc llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/llvm-16/bin/../lib/libLLVM-16.so.1+0xef9ccc)
#75 0x00007ff5599e78c3 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x243e8c3)
#76 0x00007ff5599b3182 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x240a182)
#77 0x00007ff5599b33de clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x240a3de)
#78 0x00007ff5599cdafd clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/lib/llvm-16/bin/../lib/libclang-cpp.so.16+0x2424afd)
#79 0x000055dfc831a705 clang_main(int, char**) (/usr/bin/clang++-16+0x11705)
#80 0x00007ff54fa77d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#81 0x00007ff54fa77e40 call_init ./csu/../csu/libc-start.c:128:20
#82 0x00007ff54fa77e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#83 0x000055dfc83176a5 _start (/usr/bin/clang++-16+0xe6a5)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 16.0.3 (++20230420053043+464bda7750a3-1~exp1~20230420173052.80)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/unit_tests-62814d.cpp
clang: note: diagnostic msg: /tmp/unit_tests-62814d.sh
clang: note: diagnostic msg: 

********************

See https://github.com/twig-energy/stronk/pull/36/files for the /tmp/unit_tests-62814d.cpp and /tmp/unit_tests-62814d.sh files.

tbaederr commented 1 year ago

With assertions enabled, I run into:

clang-16: /home/tbaeder/code/llvm-project/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.

which is the assertion we've seen several times in bug reports.

And the expression is:

ConceptSpecializationExpr 0x7fff6b4076a8 '_Bool' Concept 0x7fff6b998e68 'should_be_copy_constructed'
|-ImplicitConceptSpecializationDecl 0x7fff6b407628
| `-TemplateArgument type 'type-parameter-0-1'
|   `-TemplateTypeParmType 0x62100009da10 'type-parameter-0-1' dependent depth 0 index 1
`-TemplateArgument type 'T'
  `-TemplateTypeParmType 0x7fff6b9993e0 'T' dependent depth 0 index 1
    `-TemplateTypeParm 0x7fff6b999388 'T'
llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-frontend

llvmbot commented 1 year ago

@llvm/issue-subscribers-c-20

shafik commented 1 year ago

Looks related to: https://github.com/llvm/llvm-project/issues/62362 which has a small reproducer

erichkeane commented 1 year ago

These might be related? But the symptom is basically just an entire class of bugs, not necessarily the same thing. This happens any time we evaluate a constraint but don't get the template arguments setup correctly.

Also, I'm currently working on a reduction (well, CReduce now is!), but it is taking a while.

erichkeane commented 1 year ago

CReduce came up with something that looks like:

template <typename ah> concept ai = sizeof(ah) <= sizeof(ah);
template <typename ah> struct aj
 { aj() requires ai<ah>;
 };
struct at : aj<double> {
  using aj::aj;                 
};
void foo() {
    at{};
}

So Shafik is correct, this is a duplicate of #62362 . Closing this bug as a duplicate.