diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-04-14 21:45:45 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-04-14 21:45:45 +0000 |
commit | ea698b3f6cad84f7f583282dce3e03e24fe80e98 (patch) | |
tree | 851f460d8d231911fafd2df0fac4422a57fcc22d /test/SemaTemplate/temp_arg_template.cpp | |
parent | 06d9b1ad0bca7230cbae57e3e3207dda77a9eac0 (diff) | |
download | clang-ea698b3f6cad84f7f583282dce3e03e24fe80e98.tar.gz |
Detect when the string "<::" is found in code after a cast or template name and is interpreted as "[:" because of the digraph "<:". When found, give an error with a fix-it to add whitespace between the "<" and "::".
Patch by Richard Trieu! Plus a small tweak from me to deal with one of the tokens coming from a macro.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129540 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/temp_arg_template.cpp')
-rw-r--r-- | test/SemaTemplate/temp_arg_template.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/SemaTemplate/temp_arg_template.cpp b/test/SemaTemplate/temp_arg_template.cpp index 944acacd84..9c34089e61 100644 --- a/test/SemaTemplate/temp_arg_template.cpp +++ b/test/SemaTemplate/temp_arg_template.cpp @@ -30,9 +30,12 @@ template<typename T> void f(int); A<f> *a9; // expected-error{{must be a class template}} -// FIXME: The code below is ill-formed, because of the evil digraph '<:'. -// We should provide a much better error message than we currently do. -// A<::N::Z> *a10; +// Evil digraph '<:' is parsed as '[', expect error. +A<::N::Z> *a10; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + +// Do not do a digraph correction here. +A<: :N::Z> *a11; // expected-error{{expected expression}} \ + expected-error{{C++ requires a type specifier for all declarations}} // PR7807 namespace N { |