Skip to content

Pin the temporary-Entity lifetime #367 reports - #804

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
test/367-temporary-entity-lifetime
Aug 7, 2026
Merged

Pin the temporary-Entity lifetime #367 reports#804
Rafael-SOWNet merged 1 commit into
masterfrom
test/367-temporary-entity-lifetime

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Collaborator

Closes #367 — as already fixed, with the coverage it never had.

#367 reports that a method called on a temporary Entity throws NonExistentObjectAddressingException, the temporary having been destroyed and its handle released before the call using it returned:

auto simplified = AngouriMath::Entity("x + 2").Simplify();

Measured against master, it does not reproduce — that line answers 2 + x.

The recorded blocker was wrong

work/TRIAGE.md had this down as unreachable because there is no C++ toolchain here. There is: g++ 15.2 and make. Only cmake is missing, and the native AOT export publishes fine on linux-x64, so the wrapper compiles and runs directly against the .so without it.

That is the fifth blocker recorded in that file to fall on being re-measured rather than read.

Five tests, not one

A lifetime bug that is gone should be gone in every shape it would have shown in:

TemporaryEntityOutlivesTheCallOnIt the issue's own line
ResultOutlivesTheTemporaryItCameFrom result held after the temporary dies
TwoCallsChainedOffOneTemporary .Simplify().Differentiate("x")
ResultCopiedOutOfTheScopeThatMadeIt pushed into a vector from an inner scope
ManyTemporariesDoNotReleaseAHandleInUse 200 repetitions, to catch a handle freed but not yet reused

All 28 tests in the file compile and pass against the native library built from this commit.

🤖 Generated with Claude Code

#367 says a method called on a temporary Entity throws
NonExistentObjectAddressingException, the temporary having been destroyed and
its handle released before the call using it returned:

    auto simplified = AngouriMath::Entity("x + 2").Simplify();

Measured against master, it does not reproduce -- that line answers `2 + x`.

`work/TRIAGE.md` had this recorded as unreachable, on the grounds that there is
no C++ toolchain set up here. That was wrong, and is the fifth recorded blocker
in this file to fall on being re-measured rather than read. There is g++ 15.2
and make; only cmake is missing, and the native AOT export publishes fine on
linux-x64, so the wrapper can be compiled and run directly against the .so
without it.

Five tests rather than one, because a lifetime bug that is gone should be gone
in every shape it would have shown in: the issue's own line, a result outliving
the temporary it came from, two calls chained off one temporary, a result copied
out of the scope that made it, and two hundred repetitions to shake loose a
handle that is freed but not yet reused.

All 28 tests in the file compile and pass against the native library built from
this commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Rafael-SOWNet
Rafael-SOWNet merged commit 3b9df51 into master Aug 7, 2026
24 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the test/367-temporary-entity-lifetime branch August 7, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Entities seem to get destroyed too soon in AngouriMath.CPP

1 participant