atilaneves / automem

C++-style automatic memory management smart pointers for D
BSD 3-Clause "New" or "Revised" License
86 stars 15 forks source link

Fix #43 "Invariant violation in debug mode" #44

Closed drug007 closed 4 years ago

drug007 commented 4 years ago

"Uninitialize" the storage element on popBacking. Also assert(length); is useful on it own.

codecov-io commented 4 years ago

Codecov Report

Merging #44 into master will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   99.00%   99.01%   +0.01%     
==========================================
  Files          11       11              
  Lines         800      809       +9     
==========================================
+ Hits          792      801       +9     
  Misses          8        8              
Impacted Files Coverage Δ
source/automem/vector.d 98.24% <100.00%> (+0.04%) :arrow_up:
tests/ut/issues.d 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f7ec96a...56e7ed9. Read the comment docs.

drug007 commented 4 years ago

Currently tests fail because my changes are enable only in debug mode and in release mode nothing is "restored". But to my surprise the assert that checks for assigning to non default initialised non mutable member is enabled in release mode too and of course it fails. Probably the easiest way would be to add debug before the assert but it seems like a work around.

drug007 commented 4 years ago

Sorry, I have two automem repositories locally. I mixed them up and made the wrong conclusions. Currently I can not reproduce the error.

atilaneves commented 4 years ago

See comment on #43