Opened 13 years ago
Closed 12 years ago
#3856 closed Bugs (fixed)
ambiguities with make_shared() function pointers with C++0x
Reported by: | Owned by: | Peter Dimov | |
---|---|---|---|
Milestone: | Boost 1.42.0 | Component: | smart_ptr |
Version: | Boost 1.41.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Trying to store a function pointer to make_shared<Arg1> results in ambiguity errors in gcc (4.3.) with C++0x support being enabled.
The following:
typedef boost::shared_ptr<int>(*FP)();
FP fp = boost::make_shared<int>;
leads to:
error: converting overloaded function ‘make_shared’ to type ‘class boost::shared_ptr<int> (*)()’ is ambiguous
boost_1_41_0/boost/smart_ptr/make_shared.hpp:100: error: candidates are: boost::shared_ptr<X> boost::make_shared() [with T = int]
boost_1_41_0/boost/smart_ptr/make_shared.hpp:138: error: boost::shared_ptr<X> boost::make_shared(Args&& ...) [with T = int, Args = ]
Attachments (1)
Change History (5)
by , 13 years ago
Attachment: | test_make_shared.cpp added |
---|
comment:1 by , 13 years ago
Component: | None → smart_ptr |
---|---|
Owner: | set to |
comment:2 by , 13 years ago
I can remove the nullary overload, but this will make the test at source:trunk/libs/smart_ptr/test/make_shared_test.cpp#L57 to fail on gcc 4.3.x (and maybe some 4.4 versions, I haven't checked.)
comment:3 by , 12 years ago
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
simple test case