summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-27 18:58:27 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-27 18:58:27 +0000
commitfb2a0c5a5e4497847dcdf3d4402b38f321bf89ef (patch)
tree069d0fc1769c32e92718ece4ba2392dc217db7dc /www
parent8ed3adec26af254dd6df6b34546737045f353670 (diff)
downloadclang-fb2a0c5a5e4497847dcdf3d4402b38f321bf89ef.tar.gz
clang-fb2a0c5a5e4497847dcdf3d4402b38f321bf89ef.tar.bz2
clang-fb2a0c5a5e4497847dcdf3d4402b38f321bf89ef.tar.xz
Document the incompatibility that stems from Clang properly implement
the rule that defines the implicit copy constructor/implicit copy asssignment operator as deleted when a move constructor or move assignment operator has been explicitly declared. This has hit a number of people because Boost 1.47.0's shared_ptr fails to declare a copy constructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'www')
-rw-r--r--www/compatibility.html40
1 files changed, 39 insertions, 1 deletions
diff --git a/www/compatibility.html b/www/compatibility.html
index 783758f3ac..2102ccca7e 100644
--- a/www/compatibility.html
+++ b/www/compatibility.html
@@ -60,6 +60,12 @@
<li><a href="#param_name_lookup">Parameter name lookup</a></li>
</ul>
</li>
+ <li><a href="#c++11">C++11 compatibility</a>
+ <ul>
+ <li><a href="#deleted-special-func">Deleted special member
+ functions</a></li>
+ </ul>
+ </li>
<li><a href="#objective-c++">Objective-C++ compatibility</a>
<ul>
<li><a href="#implicit-downcasts">Implicit downcasts</a></li>
@@ -755,7 +761,39 @@ void f(int a, int a);
<p>Clang diagnoses this error (where the parameter name has been redeclared). To fix this problem, rename one of the parameters.</p>
<!-- ======================================================================= -->
-<h2 id="objective-c++">Objective-C++ compatibility</h3>
+<h2 id="c++11">C++11 compatibility</h2>
+<!-- ======================================================================= -->
+
+<!-- ======================================================================= -->
+<h3 id="deleted-special-func">Deleted special member functions</h3>
+<!-- ======================================================================= -->
+
+<p>In C++11, the explicit declaration of a move constructor or a move
+assignment operator within a class disables the implicit declaration
+of the copy constructor and copy assignment operator. This change came
+fairly late in the C++11 standardization process, so early
+implementations of C++11 (including Clang before 3.0, GCC before 4.7,
+and Visual Studio 2010) do not implement this rule, leading them to
+accept this ill-formed code:</p>
+
+<pre>
+struct X {
+ X(X&amp;&amp;); <i>// suppresses implicit copy constructor</i>
+};
+
+void f(X x);
+void g(X x) {
+ f(x); <i>// error: X has no copy constructor</i>
+}
+</pre>
+
+<p>This affects some C++11 code, including Boost's popular <a
+href="http://www.boost.org/doc/libs/release/libs/smart_ptr/shared_ptr.htm"><tt>shared_ptr</tt></a>
+up to version 1.47.0. The fix for Boost's <tt>shared_ptr</tt> is
+<a href="https://svn.boost.org/trac/boost/changeset/73202">available here</a>.</p>
+
+<!-- ======================================================================= -->
+<h2 id="objective-c++">Objective-C++ compatibility</h2>
<!-- ======================================================================= -->
<!-- ======================================================================= -->