[LLVMbugs] [Bug 20821] clang-cl doesn't accept two implicit conversions with a smart pointer pattern in the same way that MSVC does

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 2 09:03:46 PDT 2014


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

Hans Wennborg <hans at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #1 from Hans Wennborg <hans at chromium.org> ---
> It seems like MSVC first invokes SP::operator T*() and then invokes the ctor taking the T* from it, which requires another implicit conversion from D* to B*.  I don't think this is valid C++, but we may want to support it for compat with MSVC.

I'm surprised that they allow that (it seems to compile with the 14 CTP too).
Unless we really can't avoid it, I don't think we should support this.



For smart pointers, I think the common thing to do is to provide templates for
converting copy constructors and assignment operators, something like:

template <typename T> SP {
  ...
  template <typename U> SP(SP<U> other) { ... }
  template <typename U> void operator=(SP<U> other);
}



I'll mark this wontfix for now.

-- 
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/20140902/03b715f3/attachment.html>


More information about the llvm-bugs mailing list