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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Assertion `CanDeclareSpecialMemberFunction(RD) && "doing special member lookup into record that isn't fully complete"' failed.
        </td>
    </tr>

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

This invalid code will crash on clang trunk and clang assertion trunk:
```cpp
template<typename T>
struct Convert {};

void get_errors() {
    error; error; error; error; error; error; error; error; error; error;
    error; error; error; error; error; error; error; error; error; error;
}

void int_to_float() {
  float ce = ({ Convert<int>() } + 0);
}
```

This goes back to clang-12.

Stack dump:
```
clang++: /root/llvm-project/clang/lib/Sema/SemaLookup.cpp:3303: clang::Sema::SpecialMemberOverloadResult clang::Sema::LookupSpecialMember(clang::CXXRecordDecl*, clang::CXXSpecialMemberKind, bool, bool, bool, bool, bool): Assertion `CanDeclareSpecialMemberFunction(RD) && "doing special member lookup into record that isn't fully complete"' 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>:10:34: current parser token '+'
2.      <source>:9:21: parsing function body 'int_to_float'
3.      <source>:9:21: in compound statement ('{}')
 #0 0x0000000003bfdd38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bfdd38)
 #1 0x0000000003bfba3c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bfba3c)
 #2 0x0000000003b49038 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000073568e642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000073568e6969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000073568e642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000073568e6287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000073568e62871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000073568e639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x000000000701bc4e clang::Sema::LookupSpecialMember(clang::CXXRecordDecl*, clang::CXXSpecialMemberKind, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x701bc4e)
#10 0x000000000701be1a clang::Sema::LookupDestructor(clang::CXXRecordDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x701be1a)
#11 0x0000000006e48458 clang::Sema::MaybeBindToTemporary(clang::Expr*) (.part.0) SemaExprCXX.cpp:0:0
#12 0x00000000067ab39d clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67ab39d)
#13 0x00000000067a0e41 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a0e41)
#14 0x00000000067a20e7 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a20e7)
#15 0x00000000067a2179 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a2179)
#16 0x000000000675baf8 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x675baf8)
#17 0x000000000676ab09 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+++0x676ab09)
#18 0x0000000006773427 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6773427)
#19 0x00000000067738e9 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67738e9)
#20 0x000000000681fab2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x681fab2)
#21 0x00000000068207e0 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68207e0)
#22 0x00000000068216c5 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68216c5)
#23 0x0000000006822eca clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6822eca)
#24 0x0000000006736d73 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6736d73)
#25 0x000000000676b4ed 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+++0x676b4ed)
#26 0x000000000672aabe clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x672aabe)
#27 0x000000000672b27e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x672b27e)
#28 0x0000000006732a13 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6732a13)
#29 0x00000000067338fd clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67338fd)
#30 0x0000000006725e1a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6725e1a)
#31 0x0000000004579e08 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4579e08)
#32 0x0000000004834f69 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4834f69)
#33 0x00000000047b41de clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47b41de)
#34 0x000000000491ad6e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x491ad6e)
#35 0x0000000000cea79f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcea79f)
#36 0x0000000000ce245a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#37 0x00000000045bd009 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
#38 0x0000000003b494e4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b494e4)
#39 0x00000000045bd5ff 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
#40 0x00000000045838ed clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45838ed)
#41 0x00000000045849dd 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+++0x45849dd)
#42 0x000000000458bd95 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x458bd95)
#43 0x0000000000ce7639 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce7639)
#44 0x0000000000bb3b64 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbb3b64)
#45 0x000073568e629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#46 0x000073568e629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#47 0x0000000000ce1f0e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xce1f0e)
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/eJzsW19v2zgS_zTMC2FDImX9eciDYzd77WbRXhMc-mZQ0sjhViJ1JJU6_fQHUnJsyo7TFHGvwF3R3doiZzjzmx-HQ4pmWvO1ALhEsys0W16wztxLdfnI_2YiSqPZRS7Lx0tE5ojM7-65xga0KZgGzDVegwDFDJQ4f8QMV93376CmfWcULFEw_H8hm5bXoPC7TVtLBQrROUazq3tjWo3oHJFrRK7XssxlbaZSrRG5_o7I9Z-i_B4WYlOi2RKR9Me7k2x_eGc3Fw-s5iUuZAn4G69rXCim77EUuKiZWGOjOvEVM1EO35nWoAyXom-x4_Y646D_W7Rt_8RA09bMAKIL89iCYA3gO0Tf9a3aqK4weCHFAyiDUXKFkiWiV_sWPkhe4jWYFSgllUYkRSRzXV0zxhi7FkSv3vzDLxvCuj32mQuzMnJV1ZKZQ6_dY1wARnSJbXNytcUR0QUXxoK8lbI9rnBgY3844jZmB7RYS9A4Z8VXbGQf-ElIpvvdbo1tLbumPaRA_9WJIXJl_1pik2slpUHkuq4fmkmr5N9Q2K9Dv-ua54hc30LDhn9upPzatVNLKDqnNKBWTd-bzhGdu679pxYKzuq_oMlBfXwAVUtWfgbd1ea4QK_aE0Mk3eu6-PLlMxRSlUso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