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

    <tr>
        <th>Summary</th>
        <td>
            [Regression] clang 18 compiler crash involving source_location, declval, and default argument
        </td>
    </tr>

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

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

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

<pre>
    ### Min repro
Godbolt Link https://godbolt.org/z/4fhs6W8Pq

### Additional notes
1. Cannot reproduce on clang-17
2. replacing `__builtin_source_location()` to `nullptr` does not crash.
3. without `declval` (e.g., as a normal function) it compiles.

### Stack dump
```
0.      Program arguments: /opt/compiler-explorer/clang-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++23 <source>
1.      <source>:34:21: current parser token ';'
 #0 0x00000000037486e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x37486e8)
 #1 0x0000000003746834 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3746834)
 #2 0x0000000003691da8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000076ef0fa42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000000000714e1b5 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) ExprConstant.cpp:0:0
 #5 0x0000000007132f5e Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) ExprConstant.cpp:0:0
 #6 0x00000000071559c6 EvaluateInPlace(clang::APValue&, (anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&, clang::Expr const*, bool) (.constprop.0) ExprConstant.cpp:0:0
 #7 0x00000000071640da clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::ConstantExprKind) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x71640da)
 #8 0x00000000061b117d clang::ActionResult<clang::Expr*, true> calculateConstraintSatisfaction<calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)>(clang::Sema&, clang::Expr const*, clang::ConstraintSatisfaction&, calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, clang::SourceLocation, clang::MultiLevelTemplateArgumentList const&, clang::Expr const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)&&) SemaConcept.cpp:0:0
 #9 0x00000000061b1788 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
#10 0x00000000061b1d28 clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61b1d28)
#11 0x00000000061b2997 clang::Sema::CheckInstantiatedFunctionTemplateConstraints(clang::SourceLocation, clang::FunctionDecl*, llvm::ArrayRef<clang::TemplateArgument>, clang::ConstraintSatisfaction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x61b2997)
#12 0x0000000006a6e9ba clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool, llvm::function_ref<bool ()>) (.constprop.0) SemaTemplateDeduction.cpp:0:0
#13 0x0000000006a6f522 void llvm::function_ref<void ()>::callback_fn<clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool)::'lambda0'()>(long) SemaTemplateDeduction.cpp:0:0
#14 0x0000000006042cd1 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6042cd1)
#15 0x0000000006a66d27 clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6a66d27)
#16 0x000000000697ca56 clang::Sema::ActOnExplicitInstantiation(clang::Scope*, clang::SourceLocation, clang::SourceLocation, clang::Declarator&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x697ca56)
#17 0x0000000005f0639b clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f0639b)
#18 0x0000000005f19dbc clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f19dbc)
#19 0x0000000005fe9546 clang::Parser::ParseDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fe9546)
#20 0x0000000005feac46 clang::Parser::ParseExplicitInstantiation(clang::DeclaratorContext, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5feac46)
#21 0x0000000005ff667b clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ff667b)
#22 0x0000000005f1e022 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f1e022)
#23 0x0000000005ed5dd2 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ed5dd2)
#24 0x0000000005ed7b97 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ed7b97)
#25 0x0000000005ec6cea clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ec6cea)
#26 0x0000000003fcb35d clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fcb35d)
#27 0x000000000426d811 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x426d811)
#28 0x00000000041f0dab clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41f0dab)
#29 0x00000000043545b3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x43545b3)
#30 0x0000000000c5f9dc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5f9dc)
#31 0x0000000000c598cd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#32 0x0000000004014669 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
#33 0x00000000036921c3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x36921c3)
#34 0x0000000004014889 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
#35 0x0000000003fda505 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fda505)
#36 0x0000000003fdaedd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fdaedd)
#37 0x0000000003fe4dfc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fe4dfc)
#38 0x0000000000c5cdd1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5cdd1)
#39 0x0000000000b3ad94 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb3ad94)
#40 0x000076ef0fa29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#41 0x000076ef0fa29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#42 0x0000000000c5936e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5936e)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWltz47aS_jX0C0oqEryIfPADRx5lnZ3seG1X8qgCAVBCDAEMADry_votENQF1MX2FM_UqZMpjy0Rl_7660aj0QTSmq0EpbdB-iVI725Qa9ZS3b61fzKB11SswvymkuTtNoCx-wG_MQEUbZQMwrsgLH-RpJLcgG9MvIC1MY0O4jKAiwAuVq5pKtUqgIv_C-Aiqdc6-yN_-MuN7X_vpy4JYYZJgTgQ0lDt2qMpmCMhpHFiSYspkAJgjsRqEs1cJzi1rRxhJlYgyMLlsmoZN0wstWwVpksuMbJzBzAPYBFkITDSdhQt541R9gGRVFvBACuk11M3cTwFfzOzlq2xvQnF_BVx2zuAOZ2upgGcA6QBAkKqDeKgbgV2cgrADMBy0zBO9fS8xk8G4RdA2k3Tt2Rh_9N9DadBWDwouVJoA5BatRsqjCUYBHAhGxPARS9ATei24VJRZZ911BjVipcALiomds8C-CWAX8BkRf5Gqp4kYLICE2knQ01jp2xN05qpBpMN568bMJls82yC9Gai34RB2yC-Y8JQDiZPYDJZYTwxUnK8RkwE8d1VTLazFqjRa2nApMaSSzUhDK2E1IZhDSa1kJOOef-xNiSI77CDDmMQxHNn0iD-unOQICy8x3EZJ0FcwshShVulqDCgQUpTBYx8oQIEcBbEX-zvbgoQwDgE4Tbc_YtnSZ7RHFgarEPHpX7T7sODYsJ0hntWCNMA5odOCv29lNooijYBzKxvMGGsK3Ru9-MmC-CXcNtjsu67Bx0NQGd5nJwDPecUibb5Lp7YSiAewLwV3dIngEsrZTSIFoEHEXoQsyIiKAdza-hHiuUrVW8O038hQbiVlPeceX3mUhi6NVPcNEFcht3_vYi4FzHLaB3WKIEpDHt9OKsCuNjm2TJLJpyJdjtZidY14KmW06wD3g3xYCfHsGdRQqMqdUHHMfpkNuZ3ppmR6gvSNIjnB9o36IUusRTaLG1sgXMLBgkp3jay1UCgDdVN5zuFG3AvzNdto76-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