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

    <tr>
        <th>Summary</th>
        <td>
            Compiler crash when using [[clang::noinline]] on overloaded function call inside a templated class
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    ```
template <typename T>
class Foo {
  void foo(const int& a);

  void foo(const int& a, const int& b);

  void bar(const int& a) {
    [[clang::noinline]] foo(a);
  }
};
```

The following code results in a compiler crash as of today's trunk version.
Doesn't crash if `template <typename T>` is removed

```
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.      <source>:9:3: current parser token '}'
2.      <source>:2:1: parsing struct/union/class body 'Foo'
3.      <source>:7:26: parsing function body 'Foo::bar'
4.      <source>:7:26: in compound statement ('{}')
 #0 0x00005636d8146564 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00005636d81443ec llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3a5c3ec)
 #2 0x00005636d80870a8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f6371ea0420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00005636daef2b80 handleNoInlineAttr(clang::Sema&, clang::Stmt*, clang::ParsedAttr const&, clang::SourceRange) (.isra.0) SemaStmtAttr.cpp:0:0
 #5 0x00005636daef85f8 clang::Sema::ProcessStmtAttributes(clang::Stmt*, clang::ParsedAttributes const&, llvm::SmallVectorImpl<clang::Attr const*>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x68105f8)
 #6 0x00005636daea5b57 clang::Sema::ActOnAttributedStmt(clang::ParsedAttributes const&, clang::Stmt*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x67bdb57)
 #7 0x00005636da6d70ab clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fef0ab)
 #8 0x00005636da6d7d06 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fefd06)
 #9 0x00005636da6da032 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ff2032)
#10 0x00005636da5fcebd clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f14ebd)
#11 0x00005636da5fcb6d clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f14b6d)
#12 0x00005636da649145 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f61145)
#13 0x00005636da64cafe clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f64afe)
#14 0x00005636da61c11e clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f3411e)
#15 0x00005636da6f47f7 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x600c7f7)
#16 0x00005636da6fd19d clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x601519d)
#17 0x00005636da6fd483 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6015483)
#18 0x00005636da62978f clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f4178f)
#19 0x00005636da5f9401 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f11401)
#20 0x00005636da5fb24d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f1324d)
#21 0x00005636da5fb7e4 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f137e4)
#22 0x00005636da5ea5ca clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f025ca)
#23 0x00005636d93dbf95 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cf3f95)
#24 0x00005636d8cd6971 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45ee971)
#25 0x00005636d8c5b903 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4573903)
#26 0x00005636d8db90ab clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x46d10ab)
#27 0x00005636d59db66c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x12f366c)
#28 0x00005636d59d6c4c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#29 0x00005636d8ac1519 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#30 0x00005636d8087817 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x399f817)
#31 0x00005636d8ac174c clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#32 0x00005636d8a8bf99 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x43a3f99)
#33 0x00005636d8a8c98d 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+++0x43a498d)
#34 0x00005636d8a96f0c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x43aef0c)
#35 0x00005636d59d970f clang_main(int, char**) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x12f170f)
#36 0x00007f637194e083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#37 0x00005636d59d38ce _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0x12eb8ce)
clang-16: error: clang frontend command failed with exit code 139 (use -v to see invocation)
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlWltzozgW_jXOi8op7pcHPzhOeza73ZtUktqdN5cQwmYaI1YSaWd__R4JsBHBTrqHnpqp7SJpIsTRd75z0ZFEwtLXxSyw2su6nVlLSfdVgSVFM3clXyta4j1FzzP3U_OYFFgItGYMzcKbpgmhF5anKGNs5kSElUKivJQzJ0B45sQzt-32gc4rZLQkZ19PMB8bq48JoZl_AxcALrczdwlXyfKyyEs682_hajEYGOGl8LYdD26OY5sUNb-fdxREFAX7lpdbAJ5SxKmoCykAEsLQsq_ygnJEOBY7hAViGZIsxa8zJxRI8rr8il4oFzkrrxuRt4yKEp7K9p08QzDoeYsEFsoFjLpnLzTtYxsAfpKYfEVpva8UEbrJgiHjB862HO8R5tt6T0sp4DGaOWtWAaXrToE5PVQF45SrNsXmXGOHv5K87Npmzg1caL5Nv2GezT24Q3OmhOGqUiJrWdXyWqD5E5rPt4TMJWMF2WEQ4d5eHFN1FiWuxI5JNM8IgwfzNMfbkgmZExCZlWyuGTOagS7Bak7o0XltpbTR7C7h76Wr9CY158ABqjAXYDXJvtIS8IfKEeC3FuCMCHDgx1YC1IvKFQTQQ5QydQmmbQiCmEkg2JS8tXK7Vp47Ii9UMoO-wKwuiQRRhgjt0ToOWlneRVngkopbVpcpAARvUvYGWZHW8KZVEkKhiYOZ41rIOljwzw_cII1sL_ADDz1wCDftTs8cE_qUb0tc_A2XaaFMFangnDlLFYrNI3FNKuV0lv45yrYHsj2XElQUL_tGLfEqmptVQXFZV_dlIw1GqEsBtzRFBVNOFzcq_LjHwmUdXOwTQGCo7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