<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69838>69838</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] ICE when declaring a constructor with an explicit object parameter in the trunk
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
crash-on-invalid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zyn0217
</td>
</tr>
</table>
<pre>
(Not sure if there has been a PR on the fly addressing this, or if this is a duplicate of https://github.com/llvm/llvm-project/issues/69233; The stacktrace and the assertion I'm running into look different.)
https://clang.godbolt.org/z/x4zsfaKcb
```txt
<source>:2:5: error: an explicit object parameter cannot appear in a constructor
2 | S(this auto &self) {}
| ~~^~~~~~~~~~~~~~~~
clang++: /root/llvm-project/clang/include/clang/AST/Type.h:752: const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' 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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O0 -std=c++23 <source>
1. <source>:6:6: current parser token ';'
2. <source>:5:12: parsing function body 'main'
3. <source>:5:12: in compound statement ('{}')
#0 0x0000000003741f78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3741f78)
#1 0x000000000373fc3c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x373fc3c)
#2 0x00000000036885e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f4aaab79420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f4aaa63c00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f4aaa61b859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f4aaa61b729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f4aaa62cfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000000006969cde AdjustFunctionParmAndArgTypesForDeduction(clang::Sema&, clang::TemplateParameterList*, unsigned int, clang::QualType&, clang::QualType&, clang::Expr::Classification, clang::Expr*, unsigned int&, clang::TemplateSpecCandidateSet*) (.isra.0) SemaTemplateDeduction.cpp:0:0
#9 0x000000000698f596 clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>)::'lambda0'(clang::QualType, unsigned int, bool)::operator()(clang::QualType, unsigned int, bool) const SemaTemplateDeduction.cpp:0:0
#10 0x0000000006992e62 clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6992e62)
#11 0x00000000067a39a0 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a39a0)
#12 0x00000000065f152a ResolveConstructorOverload(clang::Sema&, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::QualType, clang::DeclContextLookupResult, clang::OverloadCandidate*&, bool, bool, bool, bool, bool) SemaInit.cpp:0:0
#13 0x000000000660243e TryConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType, clang::QualType, clang::InitializationSequence&, bool, bool) SemaInit.cpp:0:0
#14 0x000000000660a10b clang::InitializationSequence::InitializeFrom(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x660a10b)
#15 0x00000000062002e5 clang::Sema::ActOnUninitializedDecl(clang::Decl*) (.part.0) SemaDecl.cpp:0:0
#16 0x0000000005ed92c6 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ed92c6)
#17 0x0000000005ee6c40 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ee6c40)
#18 0x0000000005eef055 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+++0x5eef055)
#19 0x0000000005eef4f7 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5eef4f7)
#20 0x0000000005f8ec20 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+++0x5f8ec20)
#21 0x0000000005f8f928 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f8f928)
#22 0x0000000005f90869 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f90869)
#23 0x0000000005f9218a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f9218a)
#24 0x0000000005ebfe31 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ebfe31)
#25 0x0000000005ee7348 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ee7348)
#26 0x0000000005eb429b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5eb429b)
#27 0x0000000005eb49cf clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#28 0x0000000005ebc374 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ebc374)
#29 0x0000000005ebcb9d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ebcb9d)
#30 0x0000000005eafc4a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5eafc4a)
#31 0x00000000049a99e8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49a99e8)
#32 0x000000000420e589 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x420e589)
#33 0x000000000418f97e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x418f97e)
#34 0x00000000042ed5de clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42ed5de)
#35 0x0000000000bf11c6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbf11c6)
#36 0x0000000000be8a8a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#37 0x0000000003feb4f9 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 0x0000000003688a94 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3688a94)
#39 0x0000000003febaef 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 0x0000000003fb3995 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3fb3995)
#41 0x0000000003fb43fd 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+++0x3fb43fd)
#42 0x0000000003fbc325 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3fbc325)
#43 0x0000000000bee66c clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbee66c)
#44 0x0000000000ae7fb1 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xae7fb1)
#45 0x00007f4aaa61d083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#46 0x0000000000be856e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbe856e)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsW11zoziz_jXkRuUUSJiPi1wQJ96T3ewmZ5w9ty4hhK0dLLGSyCRzsb_9lATYFsZOZjeed6renZokNohW99OPulsfYKXYilN65U2vvenNBW70Wsirr6_ch0F8kYvi9cqDyW9CA9VIClgJ9JpKCtZYgZxSDjB4_AQEN5dBWb0CXBSSKsX4Cug1Ux6cASHb55gCTAEMiqauGMGaAlGCtda18lDmwbkH5yum101-ScTGg_Oqeu7_TGop_qBEe3DOlGqo8uA8SiFCHroGT2sKlMbks5aYUIB5YbXBSlGpmeDgzoPxBsiGc6MW41qASojPoGBlSSXl-tKDqeffeH7W_naVIhXmq8uVKHJR6UshVx6cf_Xg_CX8qkr8C8n3H_Uiv_2vX3R3Bc2UaCShHrr1UAY9lE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