<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113602>113602</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Assertion `!KnownValid && "Explicit template arguments?"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
crash-on-invalid,
clang:frontend:fuzzer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yijan4845
</td>
</tr>
</table>
<pre>
**This testcase is generated by a fuzzer.**
Compiler Explorer: [https://godbolt.org/z/G5nn9vcWz](https://godbolt.org/z/G5nn9vcWz)
This invalid code will crash on Clang Assertion Trunk.
```cpp
template <typename T> float nosplit();
template <typename T> int nosplit();
int nosplit() {
return nosplxt<int>();
}
```
It seems that this goes back to clang-9. This case can be triggered only when `did you mean 'nosplit'?` emitted by the compiler.
Stack dump:
```
clang++: /root/llvm-project/clang/lib/Sema/SemaOverload.cpp:13574: void AddOverloadedCallCandidate(clang::Sema&, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool): Assertion `!KnownValid && "Explicit template arguments?"' 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 <source>
1. <source>:4:23: current parser token ')'
2. <source>:3:15: parsing function body 'nosplit'
3. <source>:3:15: in compound statement ('{}')
#0 0x0000000003bd1a88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bd1a88)
#1 0x0000000003bcf74c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bcf74c)
#2 0x0000000003b1cdd8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007e9adb442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007e9adb4969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007e9adb442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007e9adb4287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007e9adb42871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007e9adb439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000000000713a889 AddOverloadedCallCandidate(clang::Sema&, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool) SemaOverload.cpp:0:0
#10 0x000000000713aab9 clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x713aab9)
#11 0x000000000713adbe clang::Sema::buildOverloadedCallSet(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::OverloadCandidateSet*, clang::ActionResult<clang::Expr*, true>*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x713adbe)
#12 0x00000000071474b5 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+++0x71474b5)
#13 0x0000000006cb8768 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+++0x6cb8768)
#14 0x0000000007147012 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
#15 0x00000000071476a4 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+++0x71476a4)
#16 0x0000000006cb8768 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+++0x6cb8768)
#17 0x0000000006cbaccc 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+++0x6cbaccc)
#18 0x0000000006720bed clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6720bed)
#19 0x00000000067195b1 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67195b1)
#20 0x000000000671981e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x671981e)
#21 0x000000000671b707 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x671b707)
#22 0x000000000671b799 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x671b799)
#23 0x00000000067201b9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67201b9)
#24 0x00000000067958d2 clang::Parser::ParseReturnStatement() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67958d2)
#25 0x0000000006798af5 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6798af5)
#26 0x000000000679a250 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x679a250)
#27 0x000000000679b125 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x679b125)
#28 0x000000000679c87a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x679c87a)
#29 0x00000000066b0403 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66b0403)
#30 0x00000000066e4abd 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+++0x66e4abd)
#31 0x00000000066a414e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66a414e)
#32 0x00000000066a490e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66a490e)
#33 0x00000000066ac0a3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66ac0a3)
#34 0x00000000066acf8d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66acf8d)
#35 0x000000000669f4aa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x669f4aa)
#36 0x00000000045474c8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45474c8)
#37 0x0000000004802d89 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4802d89)
#38 0x00000000047816be clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47816be)
#39 0x00000000048e85be clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48e85be)
#40 0x0000000000ce1d1f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce1d1f)
#41 0x0000000000cd99ea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#42 0x000000000458b169 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
#43 0x0000000003b1d284 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b1d284)
#44 0x000000000458b75f 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
#45 0x00000000045510dd clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45510dd)
#46 0x00000000045521cd 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+++0x45521cd)
#47 0x0000000004559af5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4559af5)
#48 0x0000000000cdebb9 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcdebb9)
#49 0x0000000000badaf4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbadaf4)
#50 0x00007e9adb429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#51 0x00007e9adb429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#52 0x0000000000cd949e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcd949e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW11z46jS_jXKDWWXhL4vcuE48b7Zzdakxnn3XLoQIJsdGXQAZZz59adAUiIU25Psiab27O5UMrEFNE8_3TQtPpBSbMspvfTiKy--vkCN3gl5-cR-RzzKoviiEOTp0oMLDy4edkwBTZXGSFHAFNhSTiXSlIDiCSBQNt--UTlvK3v-ted3_y_FvmYVleDmUFdCUumFC-DFVzuta-WFCw-uPLjaClKISs-F3Hpw9c2Dq59izvNH_K9vXnztwezt1WE-7N7iZvwRVYwALAgFX1lVASyR2gHBwbJCfAsWSlGpmeDgQTb8y7yTkPjtD67r9omm-7pCmgIvXOqnmnK0p-DBC29AWQmkAReqrpj2YGZghFffa8X4qTavSoCXdkUASKobydvyg_bCJePaC29GIrz0eqTHkJhbDRSlewX0DmmgDU1bQRUoEP4CtADYEDPL58AyaK2OEQcFBVqy7ZZKSoDg1RP4uqMceIlPGAFPogF7ijjwYPqMPvXClZf4gO6Z7vxF7yjAnWPMh6jW2nRPmn1tbH0MvcXlwSvzYzwJrqQQ2oOrqnrcz2opfqfYfO3qrSpWeHC1pnvU_fn0SGUlEJkbq4aLIIzTyEh6FIyABSF9OSVLVFVLxAkjSFMPZq3IcOGFi1Ze4sElGDy9prhaYEyVukdMjgofOi9YyG2zp1zfMaVveSnskFkCA7-tuJASPX2mpRcuB81vDrU0VY2ZHbk93meka6o7aIUQ1cvf3Gj54umGURj8wsVX_psdHbZRAjwIzVBlmGnw7LmoA62MLSH0YApKxCpKOuvd390s1jdANcWeaYBA0WyBpLWQ2vjSaPAyvWuKORb7zmqvjceUaqjy4AogTgDjuGoIbb3GDlzjpFoiTI12taS1FIZ1SoASjWwfm5ZIKYGZjVKy4UBhyWo9P-lq_tzz83spthLthypbNxO1davOa2e0D2edq81Qz6yaaRNEPLgqGH_xROOxYLYlX5EsZxGYbcFMGLmoro30RteNnisw2xsuwGx2yJIZUvuZeuIaHbzwmnFNKzAruZg9UlkIRU05mK3BbLbF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