diff options
author | John McCall <rjmccall@apple.com> | 2010-06-16 08:48:08 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-06-16 08:48:08 +0000 |
commit | d45c93c92e19085b48ff40dad97a44746debfd29 (patch) | |
tree | 1de60ec9598461256a46a7c1fec2445ce37ca3f6 | |
parent | ad00b7705f9bbee81beeac428e7c6587734ab5a6 (diff) |
Some more nods to HTML well-formedness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106094 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | www/cxx_compatibility.html | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/www/cxx_compatibility.html b/www/cxx_compatibility.html index 46e3a9f909..5ad443fc43 100644 --- a/www/cxx_compatibility.html +++ b/www/cxx_compatibility.html @@ -120,11 +120,11 @@ Note that the forthcoming C++0x standard will allow this. <p>Some versions of GCC accept the following invalid code: <pre> -#include <iostream> -#include <utility> +#include <iostream> +#include <utility> -template<typename T> -void Dump(const T& value) { +template<typename T> +void Dump(const T& value) { std::cout << value << "\n"; } @@ -132,7 +132,7 @@ namespace ns { struct Data {}; } -std::ostream& operator<<(std::ostream& out, ns::Data) { +std::ostream& operator<<(std::ostream& out, ns::Data) { return out << "Some data"; } @@ -141,8 +141,8 @@ void Use() { Dump(ns::Data()); } -template<typename T, typename U> -std::ostream& operator<<(std::ostream& out, const std::pair<T, U>& p) { +template<typename T, typename U> +std::ostream& operator<<(std::ostream& out, const std::pair<T, U>& p) { return out << '(' << p.first << ", " << p.second << ")"; } </pre> @@ -150,16 +150,16 @@ std::ostream& operator<<(std::ostream& out, const std::pair<T, U>& p) { <p>Clang complains:</p> <pre> -<b>test.cc:6:13: <span class=error>error:</span> invalid operands to binary expression ('ostream' (aka 'basic_ostream<char>') and 'std::pair<int, double> const')</b> +<b>test.cc:6:13: <span class=error>error:</span> invalid operands to binary expression ('ostream' (aka 'basic_ostream<char>') and 'std::pair<int, double> const')</b> std::cout << value << "\n"; <span class=caret>~~~~~~~~~ ^ ~~~~~</span> -<b>test.cc:18:3: note:</b> in instantiation of function template specialization 'Dump<std::pair<int, double> >' requested here +<b>test.cc:18:3: note:</b> in instantiation of function template specialization 'Dump<std::pair<int, double> >' requested here Dump(std::make_pair(3, 4.5)); <span class=caret>^</span> -<b>test.cc:6:13: <span class=error>error:</span> invalid operands to binary expression ('ostream' (aka 'basic_ostream<char>') and 'ns::Data const')</b> +<b>test.cc:6:13: <span class=error>error:</span> invalid operands to binary expression ('ostream' (aka 'basic_ostream<char>') and 'ns::Data const')</b> std::cout << value << "\n"; <span class=caret>~~~~~~~~~ ^ ~~~~~</span> -<b>test.cc:19:3: note:</b> in instantiation of function template specialization 'Dump<ns::Data>' requested here +<b>test.cc:19:3: note:</b> in instantiation of function template specialization 'Dump<ns::Data>' requested here Dump(ns::Data()); <span class=caret>^</span> 2 errors generated. @@ -168,8 +168,8 @@ std::ostream& operator<<(std::ostream& out, const std::pair<T, U>& p) { <p>The standard, in [temp.dep.candidate], says that unqualified names like <tt>operator<<</tt> are looked up when the template is defined, not when it's instantiated. Since -<tt>operator<<(std::ostream&, const std::pair<>&)</tt> -and <tt>operator<<(std::ostream&, ns::Data)</tt> were not +<tt>operator<<(std::ostream&, const std::pair<>&)</tt> +and <tt>operator<<(std::ostream&, ns::Data)</tt> were not declared yet when <tt>Dump</tt> was defined, they're not considered. <p>This is complicated by <i>argument-dependent lookup</i> (ADL), |