diff options
author | Kaelyn Takata <rikka@google.com> | 2015-01-27 22:01:39 +0000 |
---|---|---|
committer | Kaelyn Takata <rikka@google.com> | 2015-01-27 22:01:39 +0000 |
commit | 9dcf66da66a322a1fd29dff526a01ab745b8915c (patch) | |
tree | 9c67906f4c92a09cf55c5dd3c0d4c4bd579e6f79 /test/SemaCXX/typo-correction-delayed.cpp | |
parent | 619b4a3e657b37ca1b1a77eae9f1f6ca3b3ef897 (diff) |
Fix a think-o in handling ambiguous corrections for a TypoExpr.
Under certain circumstances, the identifier mentioned in the diagnostic
won't match the intended correction even though the replacement
expression and the note pointing to the decl are both correct.
Basically, the TreeTransform assumes the TypoExpr's Consumer points to
the correct TypoCorrection, but the handling of typos that appear to be
ambiguous from the point of view of TransformTypoExpr would cause that
assumption to be violated by altering the Consumer's correction stream.
This fix allows the Consumer's correction stream to be reset to the
right TypoCorrection after successfully resolving the percieved ambiguity.
Included is a fix to suppress correcting the RHS of an assignment to the
LHS of that assignment for non-C++ code, to prevent a regression in
test/SemaObjC/provisional-ivar-lookup.m.
This fixes PR22297.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/typo-correction-delayed.cpp')
-rw-r--r-- | test/SemaCXX/typo-correction-delayed.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp index f09dd330db..516b600f42 100644 --- a/test/SemaCXX/typo-correction-delayed.cpp +++ b/test/SemaCXX/typo-correction-delayed.cpp @@ -175,3 +175,13 @@ namespace PR22250 { // expected-error@+1 {{expected ';' after top level declarator}} int getenv_s(size_t *y, char(&z)) {} } + +namespace PR22297 { +double pow(double x, double y); +struct TimeTicks { + static void Now(); // expected-note {{'Now' declared here}} +}; +void f() { + TimeTicks::now(); // expected-error {{no member named 'now' in 'PR22297::TimeTicks'; did you mean 'Now'?}} +} +} |