mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-09 17:43:57 +00:00
Some more nods to HTML well-formedness.
llvm-svn: 106094
This commit is contained in:
parent
e9cccd86da
commit
89d57ae436
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user