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 erroneous __traits(isSame) comparison #61

Closed BorisCarvajal closed 3 years ago

BorisCarvajal commented 3 years ago

I'm fixing a compiler bug and the following code causes a failed assertion on this lib.

The problem is that

__traits(isSame, T, __traits(parent, obj.__xdtor))

can end up as something like:

__traits(isSame, const(Struct), Struct), which returns false, this is an problem when comparing a type with a symbol because symbols don't have qualifiers.

A natural fix could be just using Unqual!T. However, in this case the use of isSame is actually redundant, we already know __xdtor is member of T and obj is of type T.

codecov[bot] commented 3 years ago

Codecov Report

Merging #61 (b12fa8c) into master (7e0aa92) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #61   +/-   ##
=======================================
  Coverage   98.14%   98.14%           
=======================================
  Files          11       11           
  Lines         810      810           
=======================================
  Hits          795      795           
  Misses         15       15           
Impacted Files Coverage Δ
source/automem/utils.d 75.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 7e0aa92...b12fa8c. Read the comment docs.

atilaneves commented 3 years ago

Thanks!