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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Assertion `AddressOfExpr->getType() == Context.OverloadTy' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            crash-on-invalid,
            regression:19,
            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/fvWKKccTs](https://godbolt.org/z/fvWKKccTs)

This invalid code will crash on clang trunk and clang assertion trunk:
```cpp
namespace std {

  template<typename T> struct remove_reference { using type = T; };
  template<typename T> struct remove_reference<T&> { using type = T; };
  template<typename T> struct remove_reference<T&&> { using type = T; };

  template<typename T> struct is_lvalue_reference { static constexpr bool value = false; const _Bool v1 = false;; };

  template <class T> struct is_const { static constexpr bool value = false; const _Bool v2 = false; };
  template <class T> struct is_const<const T> { static constexpr bool value = true; };

 template <bool B, class T, class F> struct conditional { using type = T; };
  template <class T, class F> struct conditional<false, T, F> { using type = F; };

  template <class U, class T>
  using CopyConst = typename conditional<is_const<remove_reference<U>>::value, const T, T>::type;

  template <class U, class T>
  using OverrideRef = typename conditional<
          is_lvalue_reference<U &&>::value,
 typename remove_reference<T>::type &,
          typename remove_reference<T>::type &&>::type;

  template <class U, class T>
 using ForwardLikeRetType = OverrideRef<U &&, CopyConst<U, T>>;

 template <class U, class T>
  constexpr auto forward_like(T &&t) -> ForwardLikeRetType<U, T> {
    using TT = typename remove_reference<T>::type;
    static_assert(TT::moveable, "instantiated as_const"); 
  }
}
struct B {};
B &&(*pForwardLike)(B&) = &std::forward_like<int&&, B&>;
```

It seems that this goes back to clang-19.

Stack dump:
```
clang++: /root/llvm-project/clang/lib/Sema/SemaOverload.cpp:13264: clang::FunctionDecl* clang::Sema::ResolveAddressOfOverloadedFunction(clang::Expr*, clang::QualType, bool, clang::DeclAccessPair&, bool*): Assertion `AddressOfExpr->getType() == Context.OverloadTy' 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>:34:56: current parser token ';'
 #0 0x0000000003bfb9a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bfb9a8)
 #1 0x0000000003bf96ac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bf96ac)
 #2 0x0000000003b46ca8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007630a6e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007630a6e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007630a6e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007630a6e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007630a6e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007630a6e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000071ec27f clang::Sema::ResolveAddressOfOverloadedFunction(clang::Expr*, clang::QualType, bool, clang::DeclAccessPair&, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71ec27f)
#10 0x0000000006fc0f93 clang::InitializationSequence::Diagnose(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::ArrayRef<clang::Expr*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fc0f93)
#11 0x0000000006fb66d5 clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fb66d5)
#12 0x0000000006adf309 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6adf309)
#13 0x000000000675913a clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x675913a)
#14 0x0000000006768119 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+++0x6768119)
#15 0x00000000067280ce clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67280ce)
#16 0x000000000672888e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x672888e)
#17 0x0000000006730023 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6730023)
#18 0x0000000006730f0d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6730f0d)
#19 0x000000000672342a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x672342a)
#20 0x0000000004577d08 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4577d08)
#21 0x0000000004832e69 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4832e69)
#22 0x00000000047b20de clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47b20de)
#23 0x0000000004918c6e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4918c6e)
#24 0x0000000000ce9f2f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce9f2f)
#25 0x0000000000ce1bea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x00000000045baf09 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
#27 0x0000000003b47154 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b47154)
#28 0x00000000045bb4ff 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
#29 0x00000000045817ed clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45817ed)
#30 0x00000000045828dd 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+++0x45828dd)
#31 0x0000000004589c95 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4589c95)
#32 0x0000000000ce6dc9 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce6dc9)
#33 0x0000000000bb3954 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbb3954)
#34 0x00007630a6e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#35 0x00007630a6e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#36 0x0000000000ce169e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce169e)
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/eJzkWltz47jR_TX0C0oqEqR4efADJVv7eXe2xt9YmzyqQLIpY00RXADUyPPrUwBIiaDk28aapCpTTlYSgO7Tp7uBwwsRgm5qgGtnNndmN1eklY-MXz_TP0kdxMHsKmPF87WDUwenq0cqkAQhcyIAUYE2UAMnEgqUPSOCyvbHD-BTM9lxbxy3-_8F2za0Ao5u903FOHDHT5Ezmz9K2QjHTx28dPByw4qMVXLK-MbByx8OXpa7f_72W56vhDO7cXD8_uk4GbrXuGm9IxUtUM4KQN9pVaGcE_GIWI3yitQbJHlbPyFSF913IgRwSVltRpRfYzN0zV_eNOaXmmxBNCQHJGSBnGg-dI6QhG1TEQmOv5DPDajZaOX4t0hI3uYScdiyHaw5lMChzkFZQK2gCtNzA8jxb9T8OXKiG8ef_12zjr9YOThUMy7r4P0-3uuJinW1I1U7JklIImmOclYLCfuGo4yxCumZ2mFJKg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