<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/97770>97770</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Assertion `CalleeType->isFunctionPointerType() && "Call must have function pointer type!"` failed
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++11,
            clang:codegen,
            confirmed,
            crash
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Endilll
      </td>
    </tr>
</table>

<pre>
    This came up during reduction of https://github.com/llvm/llvm-project/issues/96623.
Code (https://godbolt.org/z/doefrKzeh):
```cpp
struct BasicPersistent {
 BasicPersistent(const char * = __builtin_FUNCTION());
};

template <typename>
decltype(BasicPersistent{}) construct_at(int) {
  return {};
}

template <typename>
static void construct() {
 construct_at<int>(0);
}

void AddObjectToUpArray() {
 construct<int>();
}
```
Clang 19.0 crash:
```
clang++: /root/llvm-project/clang/lib/CodeGen/CGExpr.cpp:5815:
clang::CodeGen::RValue clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, const clang::CodeGen::CGCallee&, const clang::CallExpr*, clang::CodeGen::ReturnValueSlot, llvm::Value*):
Assertion `CalleeType->isFunctionPointerType() && "Call must have function pointer type!"' 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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++11 <source>
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      <source>:11:13: Generating code for declaration 'construct'
 #0 0x0000000003a385c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a385c8)
 #1 0x0000000003a362bc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a362bc)
 #2 0x0000000003980688 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007e3710842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007e37108969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007e3710842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007e37108287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007e371082871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007e3710839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000041b97f8 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41b97f8)
#10 0x00000000041bb924 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41bb924)
#11 0x0000000004208fe1 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#12 0x00000000041ffdb0 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#13 0x0000000004205b4c clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4205b4c)
#14 0x00000000041946de clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41946de)
#15 0x00000000041b6ead clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41b6ead)
#16 0x0000000003d93c65 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d93c65)
#17 0x0000000003d9b8ac clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d9b8ac)
#18 0x0000000003dff026 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3dff026)
#19 0x0000000003e138dd clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e138dd)
#20 0x0000000003e73352 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e73352)
#21 0x0000000003e6e315 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e6e315)
#22 0x0000000003e79a7d clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e79a7d)
#23 0x0000000003e7c473 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e7c473)
#24 0x000000000432842e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#25 0x0000000004326075 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4326075)
#26 0x00000000063bef8c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63bef8c)
#27 0x0000000004326808 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4326808)
#28 0x00000000045ad759 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45ad759)
#29 0x000000000453336e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x453336e)
#30 0x0000000004695bae clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4695bae)
#31 0x0000000000c710c5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc710c5)
#32 0x0000000000c6a2ea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#33 0x0000000004369f39 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
#34 0x0000000003980b34 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3980b34)
#35 0x000000000436a52f 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
#36 0x000000000432ffc5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x432ffc5)
#37 0x0000000004330a2d 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+++0x4330a2d)
#38 0x0000000004338435 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4338435)
#39 0x0000000000c6e495 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc6e495)
#40 0x0000000000b46364 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb46364)
#41 0x00007e3710829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#42 0x00007e3710829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#43 0x0000000000c69d9e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc69d9e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1z4ygW_TXkhbJLAlkfD3lwnLi3Z3tmejuZ2UcXQsjWNgIVoEwyv34LkG2hOOl2Tzy1VduVTmwEl3MOl3uvJIjWzVYwdg0WN2Bxe0V6s5Pq-k5UDef8qpTV8_XDrtGQkpbBvoNVrxqxhYpVPTWNFFDWcGdMpwFeArQGaL1tzK4v51S2AK05f9z_mXVK_odRA9C60bpnGqB1kaYIz0F0C6LlSlYMApRPrMmqlNzMpdoCtP4ToHUlWa3--SfbAVTYbm4wSCP_Q7vOt2ijemrgDdEN_cyUbrRhwkCQ3fjr0ysA5VQKbSDdEQUBWkKAb-FmU_YNN43YrH_7ZfXw8ddfAMrtxHbuwRLIbo-f3W_D2o4TwyDAK_PcMUFaBvCdv1gxym0jQPkUQnZjbaECOiQW_4ZYYI2FV4ywQ8VMrwQcRoyRfC8MbYhpKHyUTXWczpMbTRQAwSsLBN8BlEd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