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

    <tr>
        <th>Summary</th>
        <td>
            ICE Instantiating defaulted assignment with explicit object parameter of base type
        </td>
    </tr>

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

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

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

<pre>
    See <https://compiler-explorer.com/z/KsvovEG1G>.
```C++
struct Base {};
struct S : Base {
    int j;
    S& operator=(this Base& self, const S&) = default;
};

void test() {
    S s;
    s = s;
}
```
```output
<source>:9:7: warning: explicitly assigning value of variable of type 'S' to itself [-Wself-assign-overloaded]
    9 | s = s;
      |     ~ ^ ~
clang++: /root/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:14386: static clang::Expr* {anonymous}::ExprBuilder::assertNotNull(clang::Expr*): Assertion `E && "Expression construction must not fail."' 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 -std=c++26 -stdlib=libc++ -pedantic-errors -Wall -Wextra -Wconversion <source> -isystem/opt/compiler-explorer/libs/boost_1_82_0
1.      <source>:9:10: current parser token ';'
2.      <source>:7:13: parsing function body 'test'
3.      <source>:7:13: in compound statement ('{}')
 #0 0x000000000372ef98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x372ef98)
 #1 0x000000000372cc5c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x372cc5c)
 #2 0x0000000003675578 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f3b76110420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f3b75bd300b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f3b75bb2859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f3b75bb2729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f3b75bc3fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x00000000062896f3 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62896f3)
 #9 0x0000000006289877 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6289877)
#10 0x000000000629c5ab buildSingleCopyAssignRecursively(clang::Sema&, clang::SourceLocation, clang::QualType, (anonymous namespace)::ExprBuilder const&, (anonymous namespace)::ExprBuilder const&, bool, bool, unsigned int) SemaDeclCXX.cpp:0:0
#11 0x000000000629d027 buildSingleCopyAssign(clang::Sema&, clang::SourceLocation, clang::QualType, (anonymous namespace)::ExprBuilder const&, (anonymous namespace)::ExprBuilder const&, bool, bool) SemaDeclCXX.cpp:0:0
#12 0x00000000062e9d41 clang::Sema::DefineImplicitCopyAssignment(clang::SourceLocation, clang::CXXMethodDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x62e9d41)
#13 0x0000000006421aa5 void llvm::function_ref<void ()>::callback_fn<clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool)::'lambda'()>(long) SemaExpr.cpp:0:0
#14 0x0000000005ff1731 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ff1731)
#15 0x0000000006418a84 clang::Sema::MarkFunctionReferenced(clang::SourceLocation, clang::FunctionDecl*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6418a84)
#16 0x0000000006418fcd MarkExprReferenced(clang::Sema&, clang::SourceLocation, clang::Decl*, clang::Expr*, bool, llvm::DenseMap<clang::VarDecl const*, int, llvm::DenseMapInfo<clang::VarDecl const*, void>, llvm::detail::DenseMapPair<clang::VarDecl const*, int>>&) SemaExpr.cpp:0:0
#17 0x000000000676c26a CreateFunctionRefExpr(clang::Sema&, clang::FunctionDecl*, clang::NamedDecl*, clang::Expr const*, bool, clang::SourceLocation, clang::DeclarationNameLoc const&) SemaOverload.cpp:0:0
#18 0x00000000067a71a6 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67a71a6)
#19 0x00000000063bcb4e BuildOverloadedBinOp(clang::Sema&, clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) SemaExpr.cpp:0:0
#20 0x0000000006441157 clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6441157)
#21 0x0000000006441723 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6441723)
#22 0x0000000005f0ab6b clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f0ab6b)
#23 0x0000000005f0e0c9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f0e0c9)
#24 0x0000000005f88c97 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f88c97)
#25 0x0000000005f7f32d 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+++0x5f7f32d)
#26 0x0000000005f80168 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f80168)
#27 0x0000000005f810a9 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f810a9)
#28 0x0000000005f829ca clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5f829ca)
#29 0x0000000005eb06e1 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5eb06e1)
#30 0x0000000005ed7bf8 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ed7bf8)
#31 0x0000000005ea4b4b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ea4b4b)
#32 0x0000000005ea527f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#33 0x0000000005eacc24 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5eacc24)
#34 0x0000000005ead44d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ead44d)
#35 0x0000000005ea04fa clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ea04fa)
#36 0x000000000499ab88 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x499ab88)
#37 0x00000000041fe849 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41fe849)
#38 0x000000000417fd1e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x417fd1e)
#39 0x00000000042dd9ee clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x42dd9ee)
#40 0x0000000000bef806 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbef806)
#41 0x0000000000be70ca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#42 0x0000000003fdbf69 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
#43 0x0000000003675a24 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3675a24)
#44 0x0000000003fdc55f 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
#45 0x0000000003fa4725 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3fa4725)
#46 0x0000000003fa518d 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+++0x3fa518d)
#47 0x0000000003fad0b5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3fad0b5)
#48 0x0000000000beccac clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbeccac)
#49 0x0000000000ae6e61 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xae6e61)
#50 0x00007f3b75bb4083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#51 0x0000000000be6bae _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbe6bae)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
I hear that EDG gets it right.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkW09z2zqS_zT0BUUXCf7VwQdZtjPO5D1no-wkNxUINiW8UAAXAB17D_PZtwBSMkFTsvNGmpnacTkxSQCN7l__BQgSpdiaA1x5ybWX3FyQVm-EvPooNlDffvh8UYjy-WoJgLxosdG6UV409_Cdh--o2DasBunDU1MLCfKSiq2H7_7Xw3d_VY_i8fZD-MGLbi-94MYL5l4adL8LD1-bX_tUadlSja6JAuRl115240Vu0xJ50fylg21CCCHGNfpj39k8WXo4RaIBSbSQXnTj4VxvmLJjTZOCuvLwAlHBlba9PTxDXnSDSqhIW-s9tSEb3f-PgpVIg9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