diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-06-05 22:42:48 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-06-05 22:42:48 +0000 |
commit | f50e88a793dd5bc7073c717fec78912e3234e95a (patch) | |
tree | 5c3f5d715bfd2623a8f80bd27ee5b61142edb48a /www/compatibility.html | |
parent | 25a857b8039bc86695614126bfe4f21035d6c76b (diff) |
Fix PR10053: Improve diagnostics and error recovery for code which some compilers incorrectly accept due to a lack of proper support for two-phase name lookup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'www/compatibility.html')
-rw-r--r-- | www/compatibility.html | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/www/compatibility.html b/www/compatibility.html index aa6a39dda1..b68a7663d4 100644 --- a/www/compatibility.html +++ b/www/compatibility.html @@ -459,13 +459,15 @@ int main() { <p>Clang complains: -<pre> <b>my_file.cpp:2:10: <span class="error">error:</span> use of undeclared identifier 'Multiply'</b> +<pre> <b>my_file.cpp:2:10: <span class="error">error:</span> call to function 'Multiply' that is neither visible in the template definition nor found by argument dependent lookup</b> return Multiply(x, x); <span class="caret"> ^</span> - <b>my_file.cpp:10:3: <span class="note">note:</span> in instantiation of function template specialization 'Squared<int>' requested here</b> Squared(5); <span class="caret"> ^</span> + <b>my_file.cpp:5:5: <span class="note">note:</span> 'Multiply' should be declared prior to the call site</b> + int Multiply(int x, int y) { + <span class="caret"> ^</span> </pre> <p>The C++ standard says that unqualified names like <q>Multiply</q> @@ -516,15 +518,17 @@ void Use() { Dump(ns::Data()); }</pre> -<p>Again, Clang complains about not finding a matching function:</p> +<p>Again, Clang complains:</p> -<pre> -<b>my_file.cpp:5: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>my_file.cpp:17:3: <span class="note">note:</span> in instantiation of function template specialization 'Dump<ns::Data>' requested here</b> - Dump(ns::Data()); - <span class="caret">^</span> +<pre> <b>my_file2.cpp:5:13: <span class="error">error:</span> call to function 'operator<<' that is neither visible in the template definition nor found by argument dependent lookup</b> + std::cout << value << "\n"; + <span class="caret"> ^</span> + <b>my_file2.cpp:17:3: <span class="error">note:</span> in instantiation of function template specialization 'Dump<ns::Data>' requested here</b> + Dump(ns::Data()); + <span class="caret"> ^</span> + <b>my_file2.cpp:12:15: <span class="error">note:</span> 'operator<<' should be declared prior to the call site or in namespace 'ns'</b> + std::ostream& operator<<(std::ostream& out, ns::Data data) { + <span class="caret"> ^</span> </pre> <p>Just like before, unqualified lookup didn't find any declarations |