This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: libstdc++ of g++ 3.4.x: std::swap and std::auto_ptr causes compilation errors
- From: Jonathan Wakely <cow at compsoc dot man dot ac dot uk>
- To: Vinzenz Feenstra <evilissimo at web dot de>
- Cc: Paolo Carlini <pcarlini at suse dot de>, libstdc++ at gcc dot gnu dot org
- Date: Tue, 16 Nov 2004 09:43:34 +0000
- Subject: Re: libstdc++ of g++ 3.4.x: std::swap and std::auto_ptr causes compilation errors
- References: <4199BC24.5020503@web.de> <4199C0B4.9010407@suse.de> <4199C40A.1040300@web.de>
On Tue, Nov 16, 2004 at 10:10:34AM +0100, Vinzenz Feenstra wrote:
> I mentioned the problem while compiling OpenC++ and OpenC++ Core there
> is a file called MetacompilerConfiguration.h which uses auto_ptr and swap
> but I made an other example which works with 3.3 and don't work with 3.4
If you enable concept-checks then your example fails with 3.3 too (as is
expected, because std::auto_ptr does not meet the Assignable requirement
for std:swap)
> I had a view on bits/stl_algobase.h of 3.3 and 3.4 this is the
> difference of them:
>
> std::swap of 3.3:
>
> template<typename _Tp>
> inline void
> swap(_Tp& __a, _Tp& __b)
> {
> // concept requirements
> __glibcpp_function_requires(_SGIAssignableConcept<_Tp>)
>
> _Tp __tmp = __a;
> __a = __b;
> __b = __tmp;
> }
>
> std::swap of 3.4
> template<typename _Tp>
> inline void
> swap(_Tp& __a, _Tp& __b)
> {
> // concept requirements
> __glibcpp_function_requires(_SGIAssignableConcept<_Tp>)
>
> const _Tp __tmp = __a; // <-- this is the problem in my opinion
You're right that this is the line that prevents compilation, but it's
not a problem, it's correct behaviour.
> __a = __b;
> __b = __tmp;
> }
jon
--
"If all these sweet young things were laid end to end,
I wouldn't be the slightest bit surprised."
- Dorothy Parker on Co-Eds