public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64135] New: Allocator base classes should use reserved names
@ 2014-12-01 11:16 redi at gcc dot gnu.org
2015-02-20 9:32 ` [Bug libstdc++/64135] " redi at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-01 11:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64135
Bug ID: 64135
Summary: Allocator base classes should use reserved names
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
This is a valid program and should compile:
#define new_allocator 1
#include <memory>
int main() { }
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/64135] Allocator base classes should use reserved names
2014-12-01 11:16 [Bug libstdc++/64135] New: Allocator base classes should use reserved names redi at gcc dot gnu.org
@ 2015-02-20 9:32 ` redi at gcc dot gnu.org
2021-11-20 12:37 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-02-20 9:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64135
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-02-20
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/64135] Allocator base classes should use reserved names
2014-12-01 11:16 [Bug libstdc++/64135] New: Allocator base classes should use reserved names redi at gcc dot gnu.org
2015-02-20 9:32 ` [Bug libstdc++/64135] " redi at gcc dot gnu.org
@ 2021-11-20 12:37 ` redi at gcc dot gnu.org
2021-12-09 23:24 ` cvs-commit at gcc dot gnu.org
2021-12-09 23:32 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-20 12:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64135
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> Another option would be to drop the base class from std::allocator when
> configured to derive from new_allocator, and just inline that code into
> std::allocator. That's an ABI break, because it would no longer have a base
> class of type __gnu_cxx::new_allocator, but maybe it's one that wouldn't
> cause any problems in practice.
I think we can mitigate the ABI break by giving __gnu_cxx::new_allocator and
std::allocator a common base class, which would still prevent them from being
potentially-overlapping subobjects as is the case today.
Testcase for the current ABI properties:
#include <memory>
#include <ext/new_allocator.h>
struct A : __gnu_cxx::new_allocator<char> { };
struct B : std::allocator<char>, A { };
struct C : std::allocator<char> { A a; };
static_assert( sizeof(B) == 2 );
static_assert( sizeof(C) == 2 );
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/64135] Allocator base classes should use reserved names
2014-12-01 11:16 [Bug libstdc++/64135] New: Allocator base classes should use reserved names redi at gcc dot gnu.org
2015-02-20 9:32 ` [Bug libstdc++/64135] " redi at gcc dot gnu.org
2021-11-20 12:37 ` redi at gcc dot gnu.org
@ 2021-12-09 23:24 ` cvs-commit at gcc dot gnu.org
2021-12-09 23:32 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-09 23:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64135
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:fe9571a35db53e5203326f854f73e432691d67f6
commit r12-5873-gfe9571a35db53e5203326f854f73e432691d67f6
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Dec 1 17:56:23 2021 +0000
libstdc++: Fix non-reserved name in std::allocator base class [PR64135]
The possible base classes of std::allocator are new_allocator and
malloc_allocator, which both cause a non-reserved name to be declared in
every program that includes the definition of std::allocator. This is
non-conforming.
This change replaces __gnu_cxx::new_allocator with std::__new_allocator
which is identical except for using a reserved name. The non-standard
extension __gnu_cxx::new_allocator is preserved as a thin wrapper over
std::__new_allocator. There is no problem with the extension using a
non-reserved name now that it's not included by default in other
headers.
The same change could be done to __gnu_cxx::malloc_allocator but as it's
not the default configuration it can wait.
libstdc++-v3/ChangeLog:
PR libstdc++/64135
* config/allocator/new_allocator_base.h: Include
<bits/new_allocator.h> instead of <ext/new_allocator.h>.
(__allocator_base): Use std::__new_allocator instead of
__gnu_cxx::new_allocator.
* doc/xml/manual/allocator.xml: Document new default base class
for std::allocator.
* doc/xml/manual/evolution.xml: Likewise.
* doc/html/*: Regenerate.
* include/Makefile.am: Add bits/new_allocator.h.
* include/Makefile.in: Regenerate.
* include/experimental/memory_resource (new_delete_resource):
Use std::__new_allocator instead of __gnu_cxx::new_allocator.
* include/ext/new_allocator.h (new_allocator): Derive from
std::__new_allocator. Move implementation to ...
* include/bits/new_allocator.h: New file.
* testsuite/20_util/allocator/64135.cc: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/64135] Allocator base classes should use reserved names
2014-12-01 11:16 [Bug libstdc++/64135] New: Allocator base classes should use reserved names redi at gcc dot gnu.org
` (2 preceding siblings ...)
2021-12-09 23:24 ` cvs-commit at gcc dot gnu.org
@ 2021-12-09 23:32 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2021-12-09 23:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64135
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |12.0
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for GCC 12, not suitable for backports.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-09 23:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-01 11:16 [Bug libstdc++/64135] New: Allocator base classes should use reserved names redi at gcc dot gnu.org
2015-02-20 9:32 ` [Bug libstdc++/64135] " redi at gcc dot gnu.org
2021-11-20 12:37 ` redi at gcc dot gnu.org
2021-12-09 23:24 ` cvs-commit at gcc dot gnu.org
2021-12-09 23:32 ` redi at gcc dot gnu.org
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).