public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
       [not found] <bug-21609-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-11 14:07 ` rguenth at gcc dot gnu.org
  2014-01-29 16:23 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-11 14:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-01-11
     Ever Confirmed|0                           |1

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-11 14:04:03 UTC ---
What's about this bug?  It lacks a testcase.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
       [not found] <bug-21609-4@http.gcc.gnu.org/bugzilla/>
  2012-01-11 14:07 ` [Bug libstdc++/21609] array_allocator vs rebind & templated constructor rguenth at gcc dot gnu.org
@ 2014-01-29 16:23 ` redi at gcc dot gnu.org
  2014-01-29 16:56 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-29 16:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It's worse than described:


// should work for any conforming Allocator
template<typename T, typename A>
void rebind(const A& a)
{
#if __cplusplus >= 201103L
  typedef std::allocator_traits<A>::template rebind_alloc<T> A2;
#else
  typedef typename A::template rebind<T>::other A2;
#endif
  A2 a2(a);
  T* p = a2.allocate(1);
  a2.deallocate(p, 1);
}

#include <ext/array_allocator.h>

int main()
{
  typedef std::tr1::array<char, 16> array;
  array mem;
  typedef __gnu_cxx::array_allocator<char, array> char_allocator;
  char_allocator a(&mem);
  rebind<int>(a);
}

This fails to compile because the rebound allocator still has array<char,16> as
its array_type, but that means _M_array->begin() is char* not int* so line 151
in array_allocator.h cannot be compiled.

Even if you alter the array_type when rebinding (which no code expecting a
conforming allocator will ever do) it fails at run-time for the reason Paolo
gave:

#include <ext/array_allocator.h>

int main()
{
  typedef std::tr1::array<char, 16> array;
  array mem;
  typedef __gnu_cxx::array_allocator<char, array> char_allocator;
  char_allocator a(&mem);

  typedef std::tr1::array<int, 4> iarray;
  typedef typename char_allocator::template rebind<int, iarray>::other A2;
  A2 a2(a);
  int* p = a2.allocate(1);   // throws
  a2.deallocate(p, 1);
}

This makes array_allocator non-conforming.

I propose we deprecate it and then remove it.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
       [not found] <bug-21609-4@http.gcc.gnu.org/bugzilla/>
  2012-01-11 14:07 ` [Bug libstdc++/21609] array_allocator vs rebind & templated constructor rguenth at gcc dot gnu.org
  2014-01-29 16:23 ` redi at gcc dot gnu.org
@ 2014-01-29 16:56 ` redi at gcc dot gnu.org
  2014-01-29 19:07 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-29 16:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
       [not found] <bug-21609-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-01-29 16:56 ` redi at gcc dot gnu.org
@ 2014-01-29 19:07 ` redi at gcc dot gnu.org
  2014-01-29 20:44 ` redi at gcc dot gnu.org
  2014-01-29 20:45 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-29 19:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No matter where I put the deprecated attribute or how many times I instantiate
the class template I can't get any deprecated warning. (PR 33911, but it
usually warns if you instantiate the type twice.)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
       [not found] <bug-21609-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-01-29 19:07 ` redi at gcc dot gnu.org
@ 2014-01-29 20:44 ` redi at gcc dot gnu.org
  2014-01-29 20:45 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-29 20:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Wed Jan 29 20:43:44 2014
New Revision: 207280

URL: http://gcc.gnu.org/viewcvs?rev=207280&root=gcc&view=rev
Log:
    PR libstdc++/21609
    * include/ext/array_allocator.h: Add deprecated attribute.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/ext/array_allocator.h


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
       [not found] <bug-21609-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-01-29 20:44 ` redi at gcc dot gnu.org
@ 2014-01-29 20:45 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-29 20:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
"Fixed" by deprecating the extension.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
  2005-05-16 16:24 [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor pcarlini at suse dot de
  2005-05-16 17:51 ` [Bug libstdc++/21609] array_allocator vs rebind & templated constructor pcarlini at suse dot de
@ 2005-05-16 18:24 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-16 18:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-16 18:24 -------
(In reply to comment #2)
> Templates are never copy constructors.

Just to clarify just in case some mistakes this for something different.
template member functions cannot be considered a copy constructor.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
  2005-05-16 16:24 [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor pcarlini at suse dot de
@ 2005-05-16 17:51 ` pcarlini at suse dot de
  2005-05-16 18:24 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2005-05-16 17:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-05-16 17:51 -------
Yes, sorry ;) (12.8). Summary fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|array_allocator vs rebind & |array_allocator vs rebind &
                   |copy-constructor            |templated constructor


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21609


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-01-29 20:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21609-4@http.gcc.gnu.org/bugzilla/>
2012-01-11 14:07 ` [Bug libstdc++/21609] array_allocator vs rebind & templated constructor rguenth at gcc dot gnu.org
2014-01-29 16:23 ` redi at gcc dot gnu.org
2014-01-29 16:56 ` redi at gcc dot gnu.org
2014-01-29 19:07 ` redi at gcc dot gnu.org
2014-01-29 20:44 ` redi at gcc dot gnu.org
2014-01-29 20:45 ` redi at gcc dot gnu.org
2005-05-16 16:24 [Bug libstdc++/21609] New: array_allocator vs rebind & copy-constructor pcarlini at suse dot de
2005-05-16 17:51 ` [Bug libstdc++/21609] array_allocator vs rebind & templated constructor pcarlini at suse dot de
2005-05-16 18:24 ` pinskia at gcc dot gnu dot 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).