This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: C++ problem enquiry before submition to gnats.
- To: Theodore Papadopoulo <Theodore dot Papadopoulo at sophia dot inria dot fr>
- Subject: Re: C++ problem enquiry before submition to gnats.
- From: Martin Sebor <sebor at roguewave dot com>
- Date: Thu, 22 Mar 2001 18:50:57 -0700
- CC: gcc-bugs at gcc dot gnu dot org
- Organization: Rogue Wave Software, Inc.
- References: <200103222113.f2MLDRg23852@mururoa.inria.fr>
Theodore Papadopoulo wrote:
>
> I'm not sure, but I seem to recall about some discussion about static
> variables in functions. Is the following problem is known ???
> If not, I'll submit a gnats bug report.
The code is ill-formed due to the violation of assignability, i.e.,
std::list<const int>::value_type doesn't satisfy the Assignable
requirement mentioned in 23.1, p5.
What you're seeing is an error caused by the definition of std::allocator
which cannot be specialized on const T (there's an open issue on this
at http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#274).
Regards
Martin
> By the way, I believe the problem appeared with the new ABI.
>
> mururoa-> cat A.C
> #include <list>
>
> struct A {
>
> typedef std::list<const int> R;
> static R r;
> };
>
> A::R A::r;
>
> void init() {
> static A a;
> }
>
> mururoa->g++ A.C
> /net/home/robotvis/gnu/egcs/include/g++-v3/bits/stl_alloc.h: In
> instantiation of `std::allocator<const int>':
> A.C:9: instantiated from here
> /net/home/robotvis/gnu/egcs/include/g++-v3/bits/stl_alloc.h:610: `const
> _Tp*
> std::allocator<_Alloc>::address(const _Tp&) const [with _Tp = const
> int]'
> has already been declared in `std::allocator<const int>'
>
> --------------------------------------------------------------------
> Theodore Papadopoulo
> Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
> --------------------------------------------------------------------