diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-06-07 15:58:05 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-06-07 15:58:05 +0000 |
commit | 57d12fd4a2bc739c4a4d62a364b7f08cd483c59e (patch) | |
tree | 529d1e5f353b48e0c3b4b0871ff42f915305c365 /docs | |
parent | 2865474261a608c7873b87ba4af110d17907896d (diff) |
PR7245: Make binding a reference to a temporary without a usable copy
constructor into an extension warning into the error that C++98 requires.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/UsersManual.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/UsersManual.html b/docs/UsersManual.html index a53a1af5ff..c19c96b4bc 100644 --- a/docs/UsersManual.html +++ b/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> <!-- ======================================================================= --> |