https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94831
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #0) > In r277342 I changed std::_Construct for P0784R7, "More constexpr > containers" and the non-void return type means this no longer compiles: > > #include <vector> > std::vector<float[2]> v(1); > > This was never valid in C++98, and in C++11 to C++17 it's undefined (because > the pseudo-destructor call in allocator_traits<std::allocator<T>>::destroy > is ill-formed for arrays). But for libstdc++ it happened to compile, because > we elide the calls to trivial destructors. We should consider making this change in stage 1, to stop silently accepting that non-standard code in strict mode: --- a/libstdc++-v3/include/bits/alloc_traits.h +++ b/libstdc++-v3/include/bits/alloc_traits.h @@ -734,6 +734,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Destroy(_ForwardIterator __first, _ForwardIterator __last, allocator<_Tp>&) { +#if __cplusplus >= 201103L && defined __STRICT_ANSI__ + static_assert(!is_array<_Tp>::value, + "arrays are not Erasable from containers using std::allocator"); +#endif _Destroy(__first, __last); }