-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<vector>
: std::vector<std::shared_ptr<mytype<T>>>
fails to compile when T is incomplete
#3842
Comments
iboB
changed the title
<vector>: std::vector<std::shared_ptr<mytype<T>>> fails to compile when T is incomplete
Jun 30, 2023
<vector>
: std::vector<std::shared_ptr<mytype<T>>>
fails to compile when T is incomplete
This is probably because of the unqualified call to Line 2045 in 40640c6
|
It isn't only diff --git a/stl/inc/vector b/stl/inc/vector
index c6552845..40f34e00 100644
--- a/stl/inc/vector
+++ b/stl/inc/vector
@@ -2052,7 +2052,7 @@ private:
_My_data._Orphan_all();
if (_Myfirst) { // destroy and deallocate old array
- _Destroy_range(_Myfirst, _Mylast, _Al);
+ _STD _Destroy_range(_Myfirst, _Mylast, _Al);^M
_ASAN_VECTOR_REMOVE;
_Al.deallocate(_Myfirst, static_cast<size_type>(_Myend - _Myfirst));
diff --git a/stl/inc/xmemory b/stl/inc/xmemory
index c2c73ef5..df8a9eba 100644
--- a/stl/inc/xmemory
+++ b/stl/inc/xmemory
@@ -966,7 +966,7 @@ public:
_CONSTEXPR20 void deallocate(_Ty* const _Ptr, const size_t _Count) {
_STL_ASSERT(_Ptr != nullptr || _Count == 0, "null pointer cannot point to a block of non-zero size");
// no overflow check on the following multiply; we assume _Allocate did that check
- _Deallocate<_New_alignof<_Ty>>(_Ptr, sizeof(_Ty) * _Count);
+ _STD _Deallocate<_New_alignof<_Ty>>(_Ptr, sizeof(_Ty) * _Count);^M
}
_NODISCARD_RAW_PTR_ALLOC _CONSTEXPR20 __declspec(allocator) _Ty* allocate(_CRT_GUARDOVERFLOW const size_t _Count) {
@@ -1084,7 +1084,7 @@ _CONSTEXPR20 void _Destroy_range(_Alloc_ptr_t<_Alloc> _First, const _Alloc_ptr_t
using _Ty = typename _Alloc::value_type;
if constexpr (!conjunction_v<is_trivially_destructible<_Ty>, _Uses_default_destroy<_Alloc, _Ty*>>) {
for (; _First != _Last; ++_First) {
- allocator_traits<_Alloc>::destroy(_Al, _Unfancy(_First));
+ allocator_traits<_Alloc>::destroy(_Al, _STD _Unfancy(_First));^M
}
}
} |
3 tasks
CaseyCarter
added a commit
to CaseyCarter/STL
that referenced
this issue
Feb 7, 2024
By qualifying `_Ugly` calls in `vector::_Tidy`, `allocator`'s member functions, and `_Destroy_range`. Fixes microsoft#3842
CaseyCarter
added a commit
to CaseyCarter/STL
that referenced
this issue
Feb 7, 2024
By qualifying `_Ugly` calls in `vector::_Tidy`, `allocator`'s member functions, and `_Destroy_range` to avoid inadvertent ADL. Fixes microsoft#3842
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Creating a vector of
shared_ptr
of a template instantiated incomplete type fails to compile withtype uses undefined class
Test case
Source:
Output:
Godbolt: https://godbolt.org/z/738sMK337
STL version
Additional info
It seems the problem is in
<vector>
and not inmemory
. Instantiatinghptr
from the demo when nostd::vector
is involved compiles fine,This code, for example, compiles:
Godbolt link: https://godbolt.org/z/zWd6E13Y3
This is also DevCom-10535345 / VSO-1926908 / AB#1926908.
The text was updated successfully, but these errors were encountered: