This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++ of g++ 3.4.x: std::swap and std::auto_ptr causes compilation errors


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]