http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56383



             Bug #: 56383

           Summary: error with multiple enable_shared_from_this base

                    classes

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Keywords: rejects-valid

          Severity: normal

          Priority: P3

         Component: libstdc++

        AssignedTo: r...@gcc.gnu.org

        ReportedBy: r...@gcc.gnu.org





This should compile and exit normally:



#include <memory>

#include <cstdlib>



struct A : std::enable_shared_from_this<A>

{

    void* a() { return shared_from_this().get(); }

};



struct B : std::enable_shared_from_this<B>

{

};



struct D : A, B

{

};



int main()

{

    auto d = std::make_shared<D>();

    try

    {

        d->a();

        std::abort();

    }

    catch (std::bad_weak_ptr const&)

    { }

}



I have a fix in mind, but it can wait for post-4.8.0

Reply via email to