DescriptionType check when upcasting PassOwnPtr/PassOwnArrayPtr to avoid possible function call ambiguousness
This change is basically extends RefPtr EnsurePtrConvertibleArg pattern to OwnPtr and OwnArrayPtr smart pointers.
Please look at the following example:
class BaseClass {};
class DerivedClass: public BaseClass {};
void foo(PassOwnPtr<BaseClass>) {}
void foo(PassOwnPtr<int /* or whatever type*/>) {}
void fooClientFunction()
{
OwnPtr<DerivedClass> ptr = adoptPtr(new DerivedClass);
foo(ptr.release());
}
before this change such snippet would have lead to "error: call of overloaded 'foo(WTF::PassOwnPtr<DerivedClass>)' is ambiguous".
This CL solves the problem.
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=157449
Patch Set 1 #
Total comments: 3
Patch Set 2 : Keeping macros in TypeTraits.h #
Total comments: 1
Patch Set 3 : No new macros introduced. Only ones from TypeTraits.h are used. #
Total comments: 1
Patch Set 4 : Attempt to remove unrelated snippet from the patch. #Patch Set 5 : Rebased. #
Messages
Total messages: 16 (0 generated)
|