summaryrefslogtreecommitdiffstats
path: root/clang/docs/UsersManual.html
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-06-07 15:58:05 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-06-07 15:58:05 +0000
commitcaa710dfd236bb2fa8aec42808aee2cef9ed99a8 (patch)
treedc9a0634d8f9bd7f28b39eed2be857372ef848c3 /clang/docs/UsersManual.html
parent18504440008badf4262c8137a8096a0a144a4d03 (diff)
downloadbcm5719-llvm-caa710dfd236bb2fa8aec42808aee2cef9ed99a8.tar.gz
bcm5719-llvm-caa710dfd236bb2fa8aec42808aee2cef9ed99a8.zip
PR7245: Make binding a reference to a temporary without a usable copy
constructor into an extension warning into the error that C++98 requires. llvm-svn: 105529
Diffstat (limited to 'clang/docs/UsersManual.html')
-rw-r--r--clang/docs/UsersManual.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/clang/docs/UsersManual.html b/clang/docs/UsersManual.html
index a53a1af5ff1..c19c96b4bcf 100644
--- a/clang/docs/UsersManual.html
+++ b/clang/docs/UsersManual.html
@@ -410,6 +410,42 @@ because it's hard to work around, Clang downgrades it to a warning as
an extension.</p>
</dd>
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<dt id="opt_Wbind-to-temporary-copy"><b>-Wbind-to-temporary-copy</b>: Warn about
+an unusable copy constructor when binding a reference to a temporary.</dt>
+<dd>This option, which defaults to on, enables warnings about binding a
+reference to a temporary when the temporary doesn't have a usable copy
+constructor. For example:</p>
+
+<pre>
+ struct NonCopyable {
+ NonCopyable();
+ private:
+ NonCopyable(const NonCopyable&);
+ };
+ void foo(const NonCopyable&);
+ void bar() {
+ foo(NonCopyable()); // Disallowed in C++98; allowed in C++0x.
+ }
+</pre>
+<pre>
+ struct NonCopyable2 {
+ NonCopyable2();
+ NonCopyable2(NonCopyable2&);
+ };
+ void foo(const NonCopyable2&);
+ void bar() {
+ foo(NonCopyable2()); // Disallowed in C++98; allowed in C++0x.
+ }
+</pre>
+
+<p>Note that if <tt>NonCopyable2::NonCopyable2()</tt> has a default
+argument whose instantiation produces a compile error, that error will
+still be a hard error in C++98 mode even if this warning is turned
+off.</p>
+
+</dd>
+
</dl>
<!-- ======================================================================= -->
OpenPOWER on IntegriCloud