[patch] Fix libstdc++/36962

Peter Dimov pdimov@mmltd.net
Fri Sep 5 16:46:00 GMT 2008


Paolo Carlini:

>> I think that the difference is detectable with get_deleter though.

> If you can figure out a possible testcase, I would appreciate that.

Something like (untested, sorry)

    D d;
    std::unique_ptr<T,D&> p1( new T, d );

    std::shared_ptr<T> p2( std::move( p1 ) );

    typedef std::reference_wrapper<D> D2;
    D2 * p3 = std::get_deleter<D2>( p2 );

    assert( p3 != 0 );
    assert( &p3->get() == &d );



More information about the Libstdc++ mailing list