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


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

Re: auto_ptr error is rather confusing


Anthony Heading wrote:

>   The following doesn't appear to compile using either 2.95.2 or 
> CodeSourcery's splendid web snapshot machine (though the
> diagnostics are very different).
> 

-snip-
 
> #include <memory>
> int main()
> {
>     std::auto_ptr<int> x;
>     x = std::auto_ptr<int>(new int);
>     return 0;
> }
> 

This code compiles with current gcc (2.96) configured with --enable-libstdcxx-v3,
because in the new c++ library, the following assignement operator was added to 
the auto_ptr class

    auto_ptr& operator=(auto_ptr_ref<X> r) throw();

This is not in the current standard, but is in accordance with proposed resolution to
the library defect report #127 
(see http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#127).

Best regards,
Artem.



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