http://llvm.org/bugs/show_bug.cgi?id=18969

            Bug ID: 18969
           Summary: Wrong make_shared picked when boost::make_shared is
                    imported
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Created attachment 12149
  --> http://llvm.org/bugs/attachment.cgi?id=12149&action=edit
code to reproduce issue

Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix


// clang++ -I/opt/local/include/ make-shared.cc

#include <string>
#include <list>
#include <boost/make_shared.hpp>

class Z
{
public:
  explicit
  Z(std::string a)
  {
  }
};

using boost::shared_ptr;
using boost::make_shared;

int main() {
  std::string a;

  shared_ptr<Z> z = make_shared<Z>(a);
}


This code does not compile with clang++. Compiler complains:

make-shared.cc:22:17: error: no viable conversion from 'shared_ptr<Z>' (aka
      'std::__1::shared_ptr<Z>') to 'shared_ptr<Z>' (aka
'boost::shared_ptr<Z>')


libboost is version 1.55 installed from Macports.

It seems that std::__1::make_shared is picked, even if boost::make_shared is
imported to current namespace. This happens only if the Z constructor takes a
STL type such as std::string or std::list<int>. It does not happen if Z
constructor takes an int.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to