Boost logo

Boost :

Subject: Re: [boost] [exception] [shared_ptr] ADL problem with msvc 10
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-04-17 13:43:59


AMDG

Peter Dimov wrote:
> Steven Watanabe wrote:
>> I just tried to compile the following
>>
>> #include <boost/exception_ptr.hpp>
>> void f() {}
>>
>> msvc 10 complains,
>> 1>c:\boost\trunk\boost\smart_ptr\detail\sp_convertible.hpp(48): error
>> C2660: 'f' : function does not take 1 arguments
> ...
>> This appears to be because type_info is defined in the global namespace,
>> so ADL for boost::error_info<boost::tag_original_exception_type, const
>> type_info *>
>> picks up the global f. I don't have a fix for this yet.
>
> You mean apart from renaming f to something like _spc_helper_f? :-)
>
> Lookup from within a class scope shouldn't activate ADL when it finds
> a member, so it seems to me that MSVC 10 is wrong here, but I don't
> have chapter and verse handy, so who knows.

I think that the compiler is correct to find the global f, but I don't think
it should cause the static f to be hidden.

3.4.2 "When an unqualified name is used as the postfix-expression in a
function call..."
5.2.2 "There are two kinds of function call: ordinary function call and
member function57) (9.3) call."
footnote 57 "A static member function (9.4) is an ordinary function."

Anyway, the attached patch fixes this problem (and
http://svn.boost.org/trac/boost/ticket/4108)
and should be harmless for other compilers.

In Christ,
Steven Watanabe




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk