[LLVMbugs] [Bug 18969] New: Wrong make_shared picked when boost::make_shared is imported

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 25 14:41:47 PST 2014


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: unassignedclangbugs at nondot.org
          Reporter: sunnylandh at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140225/6331492a/attachment.html>


More information about the llvm-bugs mailing list