public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/94831] [10 Regression] vector<float[2]> no longer compiles
Date: Tue, 28 Apr 2020 21:39:50 +0000 [thread overview]
Message-ID: <bug-94831-4-th6G2jKx2H@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94831-4@http.gcc.gnu.org/bugzilla/>
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);
}
next prev parent reply other threads:[~2020-04-28 21:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 19:45 [Bug libstdc++/94831] New: " redi at gcc dot gnu.org
2020-04-28 19:46 ` [Bug libstdc++/94831] " redi at gcc dot gnu.org
2020-04-28 20:01 ` redi at gcc dot gnu.org
2020-04-28 21:39 ` redi at gcc dot gnu.org [this message]
2020-04-28 22:48 ` cvs-commit at gcc dot gnu.org
2020-04-28 22:54 ` redi at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-94831-4-th6G2jKx2H@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).