[patch] libstdc++/56383 Fix ambiguity with multiple enable_shared_from_this bases

Jonathan Wakely jwakely@redhat.com
Wed Dec 2 15:08:00 GMT 2015


The friend function defined in enable_shared_from_this did not match
the declaration at namespace scope, so instead of defining the
previously declared function it added a new overload, which was always
a better match than the declared (but never defined) one.

That worked fine for a single base class, the friend function got
found by ADL, but with two enable_shared_from_this base classes the
two friend overloads were ambiguous.

This changes the friend to match the declaration, so that it can only
be called when an unambiguous enable_shared_from_this base can be
deduced, and so fails silently (as it is supposed to) when there is
not an unambiguous base class.

Tested powerpc64le-linux, committed to trunk.

This fix is simple enough that I'm going to backport it after 5.3 is
released.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 4846 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151202/fdf85cfc/attachment.bin>


More information about the Gcc-patches mailing list