title: clang libc++ error: overload resolution selected implicitly-deleted copy assignment operator
body: <p>I can't get a C++11 project using clang 3.1 to compile. The command to the compiler is this:</p>
  
  <pre><code>clang++-mp-3.1 -c -std=c++11 -stdlib=libc++ -Wall -g -Iinclude -I/usr/local/include -I/opt/local/include -I/usr/local/include/mongo -o world.o world.cpp
  </code></pre>
  
  <p>And the error I get, since I included the "-stdlib=libc++" directive, is this:</p>
  
  <pre><code>In file included from world.cpp:1:
  /usr/include/c++/v1/string:1952:10: error: overload resolution selected implicitly-deleted copy assignment operator
      __r_ = _STD::move(__str.__r_);
           ^
  /usr/include/c++/v1/string:1942:9: note: in instantiation of member function 'std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::__move_assign' requested here
          __move_assign(__str, true_type());
          ^
  /usr/include/c++/v1/string:1961:5: note: in instantiation of member function 'std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::__move_assign' requested here
      __move_assign(__str, integral_constant&lt;bool,
      ^
  /usr/include/c++/v1/utility:200:24: note: in instantiation of member function 'std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;::operator=' requested here
  struct _LIBCPP_VISIBLE pair
                         ^
  /usr/include/c++/v1/memory:1941:5: note: copy assignment operator is implicitly deleted because '__compressed_pair&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt;
        &gt;::__rep, std::__1::allocator&lt;char&gt; &gt;' has a user-declared move constructor
      __compressed_pair(__compressed_pair&amp;&amp; __p)
      ^
  1 error generated.
  </code></pre>
  
  <p>Can anyone advise me on how I can get this to work?</p>
  
  <p>The file I'm trying to compile doesn't even have to include any C++11 code for this error to occur, the "-stdlib=libc++" directive alone is enough to make it break.</p>
  
  <p>Thanks for any &amp; all assistance,
     Doug.</p>
  
  <p>UPDATE:
  Hi -- the code is pretty basic, but in making it as basic as possible, I came across this error:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "std::__1::cout", referenced from:
        _main in world.o
    "std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;::sentry::sentry(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;)", referenced from:
        std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::operator&lt;&lt; &lt;std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*) in world.o
    "std::__1::ios_base::clear(unsigned int)", referenced from:
        std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::operator&lt;&lt; &lt;std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*) in world.o
    "std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;::sentry::~sentry()", referenced from:
        std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::operator&lt;&lt; &lt;std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*) in world.o
    "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
        std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp; std::__1::operator&lt;&lt; &lt;std::__1::char_traits&lt;char&gt; &gt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, char const*) in world.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>To get this error, I stripped my code back to this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  int main( int argc, char *argv[] )
  {
    std::cout &lt;&lt; "Hi.\n";
  }
  </code></pre>
  
  <p>Which makes this look like something pretty fundamentally wrong.</p>
  
  <p>I don't get this error when I take out the "-stdlib=libc++" directive to the compiler.</p>