[LLVMbugs] [Bug 10945] can't compile boost::thread with -std=c++0x

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 10 12:15:51 PDT 2011


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

Douglas Gregor <dgregor at apple.com> changed:

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

--- Comment #9 from Douglas Gregor <dgregor at apple.com> 2011-10-10 14:15:50 CDT ---
(In reply to comment #6)
> From the cfe-dev thread, I think this is by design. 
> 
> shared_ptr defines a move constructor (t.cc:22083) but relies on a constructor
> template (immediately above, t.cc:22079) for copy construction. The letter of
> the law (12.8p7) says:
> 
> "If the class definition declares a move constructor or move assignment
> operator, the implicitly declared copy constructor is defined as deleted;
> otherwise, it is defined as defaulted"
> 
> Without this clause I'm not entirely sure what should've happened - I suppose
> the default copy ctor should've been implicitly provided (from my cursory
> glance of the code it seems like the default would've been correct/sufficient)
> and the constructor template that looks like it could do copy would've been
> ignored.
> 
> With this clause that no longer works, the copy ctor is marked as deleted and
> fails to compile.
> 
> A simpler example is this:
> 
> struct foo {
>   void operator=(foo&&);
> } g((foo()));
> 
> Which compiles without error in g++ but fails in clang++. So far as I'm reading
> the spec, clang is correct and GCC is incorrect.

Yes, this is correct. GCC 4.6.1 doesn't implement this clause yet, because it
came into C++11 relatively late. Closing this as "invalid": it's a GCC and
Boost bug, not a Clang bug. There is a little more information here

  http://clang.llvm.org/compatibility.html#deleted-special-func

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list