diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-12-12 01:35:42 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-12-12 01:35:42 -0800 |
commit | f04b23092c201e13229ee90625d03e97286649f4 (patch) | |
tree | 8b8651b3ac2c9dfb2e06d94ef6ae6abb2f91d033 /starts/meaning-vm/level1.cpp | |
parent | c87af57ce54cac3ae7f49758f3fc3fb6e0abb451 (diff) | |
download | standingwithresilience-f04b23092c201e13229ee90625d03e97286649f4.tar.gz standingwithresilience-f04b23092c201e13229ee90625d03e97286649f4.zip |
this code appears to make a try{} block loop in a weird compiler exception edgecase, narroing
Diffstat (limited to 'starts/meaning-vm/level1.cpp')
-rw-r--r-- | starts/meaning-vm/level1.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/starts/meaning-vm/level1.cpp b/starts/meaning-vm/level1.cpp index 3c1a634..51c7fdd 100644 --- a/starts/meaning-vm/level1.cpp +++ b/starts/meaning-vm/level1.cpp @@ -65,7 +65,21 @@ int main() std::cout << apple.dump("dumped", true) << std::endl; std::cout << intellect::level0::allocated() << " allocated" << std::endl; - intellect::level0::dealloc(intellect::level0::concepts::allocations(), intellect::level0::concepts::level0allocations()); + while (true) { + try { + std::cout << "calling dealloc" << std::endl; + intellect::level0::dealloc(intellect::level0::concepts::allocations(), intellect::level0::concepts::level0allocations()); + } catch (intellect::level0::still_referenced_by &e) { + std::cout << "expected exception" << std::endl; + if (e.topic->linked(intellect::level0::concepts::allocates(), e.referrer)) { + intellect::level0::dealloc(e.referrer, e.topic); + } else { + throw; + } + } catch (...) { + std::cout << "unexpected exception" << std::endl; + } + } std::cout << intellect::level0::allocated() << " allocated" << std::endl; return 0; |