You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug atomic<shared_ptr<Ty>> and atomic<weak_ptr<Ty>> does not work when Ty is and an array { Ty = T[] || T[N] }.
No sure if this is intended. [util.smartptr.atomic] does not really specify.
STL version
All of them but locally I ran into the problem with: Microsoft Visual Studio Community 2019 Preview Version 16.8.0 Preview 3.2 Additional context
The issue seems come from a mismatch between the type used to represent the internal pointer in shared_ptr and weak_ptr compared to atomic<x_ptr<>> . shared_ptr<T>::element_type and weak_ptr<T>::element_type is of type remove_extent_t<T> while atomic<x_ptr<T>> internal representation is just T*. So it ends up trying to perform operations between T[] * and T*
I implemented my own fix (0fd8850) so I could continue with my projects.
Simply changed:
- _Ty*+ remove_extent_t<_Ty>*
Also extended the one test suit (975ac24) as a sanity check.
(Does not test wait, notify_one and notify_all)
The text was updated successfully, but these errors were encountered:
Thanks, this does seem like a bug to me. The atomic machinery should be completely orthogonal to the pointed-to object/array, but we just forgot about this potential interaction 🙀
Describe the bug
atomic<shared_ptr<Ty>>
andatomic<weak_ptr<Ty>>
does not work whenTy
is and an array{ Ty = T[] || T[N] }
.No sure if this is intended. [util.smartptr.atomic] does not really specify.
Code test case
Godbolt example (Uncomment lines)
Expected behavior
For the code to be compiled.
STL version
All of them but locally I ran into the problem with:
Microsoft Visual Studio Community 2019 Preview Version 16.8.0 Preview 3.2
Additional context
The issue seems come from a mismatch between the type used to represent the internal pointer in
shared_ptr
andweak_ptr
compared toatomic<x_ptr<>>
.shared_ptr<T>::element_type
andweak_ptr<T>::element_type
is of typeremove_extent_t<T>
whileatomic<x_ptr<T>>
internal representation is justT*
. So it ends up trying to perform operations betweenT[] *
andT*
I implemented my own fix (0fd8850) so I could continue with my projects.
Simply changed:
Also extended the one test suit (975ac24) as a sanity check.
(Does not test
wait
,notify_one
andnotify_all
)The text was updated successfully, but these errors were encountered: