<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/110319>110319</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang++] Frontend Assertion Failure in clang::Sema::LookupSpecialMember
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yype
</td>
</tr>
</table>
<pre>
Hello there, clang++ crashes at an assertion failure on the following test case:
```cpp
struct a b() { ({a()
```
Tested version(s): 12.0.0 ~ 19.1.0, trunk.
Example: https://godbolt.org/z/Mf6nnz7Kb
This might be related to https://github.com/llvm/llvm-project/issues/76228. However, the test case provided there no longer reproduces the crash on trunk.
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 -emit-llvm -O3 <source>
1. <eof> parser at end of file
2. <source>:1:14: parsing function body 'b'
3. <source>:1:14: in compound statement ('{}')
#0 0x0000000003b86708 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b86708)
#1 0x0000000003b843cc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b843cc)
#2 0x0000000003ad2b58 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x0000743683642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007436836969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x0000743683642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007436836287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000074368362871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x0000743683639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000006e6b6d2 clang::Sema::LookupSpecialMember(clang::CXXRecordDecl*, clang::CXXSpecialMemberKind, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e6b6d2)
#10 0x0000000006e6b8da clang::Sema::LookupDestructor(clang::CXXRecordDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e6b8da)
#11 0x0000000006cce828 clang::Sema::MaybeBindToTemporary(clang::Expr*) (.part.0) SemaExprCXX.cpp:0:0
#12 0x0000000006681ebd clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6681ebd)
#13 0x0000000006677961 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6677961)
#14 0x0000000006678c07 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6678c07)
#15 0x0000000006678c99 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6678c99)
#16 0x000000000667d6b9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x667d6b9)
#17 0x00000000066ff699 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66ff699)
#18 0x00000000066f62fc 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+++0x66f62fc)
#19 0x00000000066f7210 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f7210)
#20 0x00000000066f80e5 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f80e5)
#21 0x00000000066f983a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66f983a)
#22 0x000000000660c643 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x660c643)
#23 0x0000000006641e6d 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+++0x6641e6d)
#24 0x000000000660038e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x660038e)
#25 0x0000000006600b4e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6600b4e)
#26 0x00000000066082e3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66082e3)
#27 0x00000000066091cd clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66091cd)
#28 0x0000000006609670 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6609670)
#29 0x00000000065fb6b2 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65fb6b2)
#30 0x00000000044dd0c8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44dd0c8)
#31 0x0000000004796d49 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4796d49)
#32 0x00000000047155ce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47155ce)
#33 0x000000000487c86e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x487c86e)
#34 0x0000000000cceeff cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcceeff)
#35 0x0000000000cc6c0a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#36 0x0000000004521349 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
#37 0x0000000003ad3004 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ad3004)
#38 0x000000000452193f 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
#39 0x00000000044e6ccd clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44e6ccd)
#40 0x00000000044e7dbd 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+++0x44e7dbd)
#41 0x00000000044efa75 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44efa75)
#42 0x0000000000ccbdcf clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xccbdcf)
#43 0x0000000000b9b7f4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb9b7f4)
#44 0x0000743683629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#45 0x0000743683629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#46 0x0000000000cc66be _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcc66be)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
The test case was generated by a fuzzer.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWk9z2zjy_TT0BUUVCVL8c_BBlqOZzGQq-cWuX-WmAsGmhA0FcAFQlnLYz74FkLIIWpbtWSuV2p0axzSJbrx-aDQeQRCl2IoDXHvTG296e0VavRbyer9v4KoQ5f76d6hrgfQaJHh4jmhN-MrDNx6-QVQStQaFiEaEI6IUSM0ERxVhdSsBCW7sUCXqWjwwvkIalEaUKPCimRfcesHh3yTo_qdN091RWrZUI4IKD2cezpGX3iBzmd6Q7s7IcujuHp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