summaryrefslogtreecommitdiff
path: root/test/SemaCXX/typo-correction-pt2.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2014-12-13 02:54:28 +0000
committerNick Lewycky <nicholas@mxc.ca>2014-12-13 02:54:28 +0000
commita961126dfcc6ef381f898df8520a862c57098159 (patch)
treed007bf10059e677b167ef1be9ffcbd056f5daea9 /test/SemaCXX/typo-correction-pt2.cpp
parent35d74535f8fb6d7caf7ebe5b9ba0c027e8cd220f (diff)
downloadclang-a961126dfcc6ef381f898df8520a862c57098159.tar.gz
Fix two small bugs in typo correction. One assertion failure building member expressions because the lookup finds a different name than the original, fixed by updating the LookupResult's name with the name of the found decl. Second is that we also diagnose delayed typo exprs in the index of an array subscript expression.
The testcase shows a third bug with a FIXME in it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/typo-correction-pt2.cpp')
-rw-r--r--test/SemaCXX/typo-correction-pt2.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/SemaCXX/typo-correction-pt2.cpp b/test/SemaCXX/typo-correction-pt2.cpp
index 5d3f1236ac..73c8cb5a55 100644
--- a/test/SemaCXX/typo-correction-pt2.cpp
+++ b/test/SemaCXX/typo-correction-pt2.cpp
@@ -332,3 +332,27 @@ int test(Foo f) {
return 0;
}
};
+
+namespace testMemberExprDeclarationNameInfo {
+ // The AST should only have the corrected name with no mention of 'data_'.
+ // FIXME: the second typo is being printed out with the location of the first
+ // because the TypoCorrection objects contain the SourceRange but the
+ // UnqualifiedTyposCorrected cache is keyed on IdentifierInfo.
+ void f(int);
+ struct S {
+ int data; // expected-note 2{{'data' declared here}}
+ void m_fn1() {
+ data_[] = // expected-error 2{{use of undeclared identifier 'data_'}} expected-error {{expected expression}}
+ f(data_);
+ }
+ };
+}
+
+namespace testArraySubscriptIndex {
+ struct S {
+ int foodata; // expected-note {{'foodata' declared here}}
+ void m_fn1() {
+ (+)[foodata_]; // expected-error{{expected expression}} expected-error {{use of undeclared identifier 'foodata_'; did you mean 'foodata'}}
+ }
+ };
+}