public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary
@ 2024-02-04 20:53 ibuclaw at gdcproject dot org
  2024-02-12 16:08 ` [Bug d/113758] " cvs-commit at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ibuclaw at gdcproject dot org @ 2024-02-04 20:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113758

            Bug ID: 113758
           Summary: d: Callee destructor call invalidates the live object,
                    not the temporary
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

D ABI does callee destruction of arguments, which depends on the argument
already being copied to a temporary before passing by ref.

At some point, the front-end stopped explicitly generating this temporary, so
now the code generator must take care of it.
---
struct Sdtor
{
    int field;
    ~this() { field = 0; }
}

void main()
{
    auto var = Sdtor(1);
    callee(var);
    assert(var.field == 1); // fails.
}

void callee(Sdtor param) { }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-03  0:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-04 20:53 [Bug d/113758] New: d: Callee destructor call invalidates the live object, not the temporary ibuclaw at gdcproject dot org
2024-02-12 16:08 ` [Bug d/113758] " cvs-commit at gcc dot gnu.org
2024-03-03  0:00 ` cvs-commit at gcc dot gnu.org
2024-03-03  0:04 ` cvs-commit at gcc dot gnu.org
2024-03-03  0:09 ` cvs-commit at gcc dot gnu.org
2024-03-03  0:12 ` ibuclaw at gdcproject dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).