summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/temp_arg_nontype.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-26 21:00:50 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-26 21:00:50 +0000
commit4b2d3f7bcc4df31157df443af1b80bcaa9b58bba (patch)
tree96959034b8994e16339fe5cc3ba2030d618c8c5c /test/SemaTemplate/temp_arg_nontype.cpp
parent8958891f5fa1e593c4519a36b3df427ee019d70b (diff)
downloadclang-4b2d3f7bcc4df31157df443af1b80bcaa9b58bba.tar.gz
clang-4b2d3f7bcc4df31157df443af1b80bcaa9b58bba.tar.bz2
clang-4b2d3f7bcc4df31157df443af1b80bcaa9b58bba.tar.xz
Introduce code modification hints into the diagnostics system. When we
know how to recover from an error, we can attach a hint to the diagnostic that states how to modify the code, which can be one of: - Insert some new code (a text string) at a particular source location - Remove the code within a given range - Replace the code within a given range with some new code (a text string) Right now, we use these hints to annotate diagnostic information. For example, if one uses the '>>' in a template argument in C++98, as in this code: template<int I> class B { }; B<1000 >> 2> *b1; we'll warn that the behavior will change in C++0x. The fix is to insert parenthese, so we use code insertion annotations to illustrate where the parentheses go: test.cpp:10:10: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++0x B<1000 >> 2> *b1; ^ ( ) Use of these annotations is partially implemented for HTML diagnostics, but it's not (yet) producing valid HTML, which may be related to PR2386, so it has been #if 0'd out. In this future, we could consider hooking this mechanism up to the rewriter to actually try to fix these problems during compilation (or, after a compilation whose only errors have fixes). For now, however, I suggest that we use these code modification hints whenever we can, so that we get better diagnostics now and will have better coverage when we find better ways to use this information. This also fixes PR3410 by placing the complaint about missing tokens just after the previous token (rather than at the location of the next token). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/temp_arg_nontype.cpp')
-rw-r--r--test/SemaTemplate/temp_arg_nontype.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp
index d67cc4e409..55815fce1f 100644
--- a/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/test/SemaTemplate/temp_arg_nontype.cpp
@@ -7,7 +7,7 @@ A<int()> *a1; // expected-error{{template argument for non-type template paramet
A<int> *a2; // expected-error{{template argument for non-type template parameter must be an expression}}
-A<1 >> 2> *a3;
+A<1 >> 2> *a3; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++0x}}
// C++ [temp.arg.nontype]p5:
A<A> *a4; // expected-error{{must have an integral or enumeration type}} \