<xmemory>
: allocate_at_least
optimization broken by private
inheritance from std::allocator
#3890
Labels
<xmemory>
: allocate_at_least
optimization broken by private
inheritance from std::allocator
#3890
After #3864, VSO-1852860 / AB#1852860 "[RWC][prod/fe][std:c++latest][Regression] Catch2 failed with error C2247 and error C2248" was reported, due to a custom allocator privately inheriting from
std::allocator
(see https://github.com/catchorg/Catch2/blob/4acc51828f7f93f3b2058a63f54d112af4034503/tests/SelfTest/UsageTests/Matchers.tests.cpp#L229-L254 ):This appears to involve an MSVC compiler bug in SFINAE, because Clang accepts this code. For MSVC, it appears that classic SFINAE is properly detecting that
typename _Ty::_From_primary
is inaccessible, but then Expression SFINAE is incorrectly detecting thatallocate_at_least
is accessible:STL/stl/inc/xmemory
Lines 473 to 480 in f51733c
STL/stl/inc/xmemory
Lines 2177 to 2190 in f51733c
We should report this compiler bug, and then we may need to work around it with
is_base_of
to bluntly forbid allstd::allocator
inheritance (is_base_of
sees through private and ambiguous bases).The text was updated successfully, but these errors were encountered: