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

    <tr>
        <th>Summary</th>
        <td>
            [Regression] clang 18 compiler crash involving auto return type, auto-conversion and source_location
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    ### Min repro
```C++
#include <memory>
#include <source_location>

struct IntConstuctible
{
    IntConstuctible() = default;

    IntConstuctible(int,
                    const std::source_location& /*loc*/ = std::source_location::current()) noexcept
 {
    }
};

static auto construct_at_address_of(IntConstuctible& p, int a)
{
    //
 return std::construct_at(&p, a);
}

int main()
{
 IntConstuctible instance{};
    construct_at_address_of(instance, 1);
 return 0;
}
```

### Godbolt Link
https://godbolt.org/z/a4TxoE9jv


### Additional notes
1) Repros in clang-18, including the currently-latest release 18.1.6. 
2) Does not repro with clang-17.
3) Specifying the return type of `construct_at_address_of()` explicitly does not crash. 
4) Removing the `return`  from `construct_at_address_of()` does not crash.
5) Having no `source_location` parameter in the auto-converted type does not crash. 
6) Passing a `std::source_location::current()` instead of relying on the default parameter does not crash..


### Stack dump
```
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-18.1.0/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-13.2.0 -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 -Wall -Wextra -pedantic-errors <source>
1.      <eof> parser at end of file
2.      <source>:20:5: LLVM IR generation of declaration 'main'
3.      <source>:20:5: Generating code for declaration 'main'
 #0 0x000000000351ae38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x351ae38)
 #1 0x0000000003518f84 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3518f84)
 #2 0x0000000003467018 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000737126e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000000002f4b6fa llvm::FunctionType::get(llvm::Type*, llvm::ArrayRef<llvm::Type*>, bool) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x2f4b6fa)
 #5 0x0000000003b7623e clang::CodeGen::CodeGenTypes::GetFunctionType(clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3b7623e)
 #6 0x000000000392c7b3 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x392c7b3)
 #7 0x00000000038ec7aa clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl, llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x38ec7aa)
 #8 0x0000000003bd9196 EmitFunctionDeclPointer(clang::CodeGen::CodeGenModule&, clang::GlobalDecl) CGExpr.cpp:0:0
 #9 0x0000000003be7db4 EmitDirectCallee(clang::CodeGen::CodeGenFunction&, clang::GlobalDecl) CGExpr.cpp:0:0
#10 0x0000000003c023fd clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr const*) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3c023fd)
#11 0x0000000003c027cd clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3c027cd)
#12 0x0000000003c4bee5 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#13 0x0000000003c40612 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#14 0x0000000003c428c3 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3c428c3)
#15 0x0000000003be5a1e clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3be5a1e)
#16 0x0000000003bff3fb clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3bff3fb)
#17 0x0000000003821c9e clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3821c9e)
#18 0x0000000003827b39 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3827b39)
#19 0x0000000003885ec4 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3885ec4)
#20 0x0000000003891492 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3891492)
#21 0x00000000038ec95b clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x38ec95b)
#22 0x00000000038e86d5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x38e86d5)
#23 0x00000000038e9350 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x38e9350)
#24 0x00000000038f13e7 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#25 0x0000000003d5cc96 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#26 0x0000000003d4e9b9 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3d4e9b9)
#27 0x0000000005b963a4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x5b963a4)
#28 0x0000000003d5a725 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3d5a725)
#29 0x0000000003fe2aa1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3fe2aa1)
#30 0x0000000003f6010b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3f6010b)
#31 0x00000000040c2473 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x40c2473)
#32 0x0000000000c19746 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0xc19746)
#33 0x0000000000c1211d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#34 0x0000000003da1979 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
#35 0x0000000003467443 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3467443)
#36 0x0000000003da1b99 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
#37 0x0000000003d69d17 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3d69d17)
#38 0x0000000003d6a6cd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3d6a6cd)
#39 0x0000000003d7445c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0x3d7445c)
#40 0x0000000000c16a21 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0xc16a21)
#41 0x0000000000b0fa84 main (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0xb0fa84)
#42 0x0000737126e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#43 0x0000737126e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#44 0x0000000000c1191e _start (/opt/compiler-explorer/clang-18.1.0/bin/clang+++0xc1191e)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1z4ygW_TXKCyWXhGR9POTBsZNMT_XU9Ha6eh5dCJCjCQYVoIy9v34LkGyh2Pkaz9ZWbVc6sRHce87lwL2SQEo1G07pdTC_CearK9TpRyGvEaO7JySRRhI9NeqqEmR_HcDE_YDfGg4kbaUIolUQLYIscj_LAN6YH9cKk4Zj1hEKgmS5pVsh90Fye-qiEp3EdM0ERroR_NjL_lZ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