Index: lib/Parse/ParseExpr.cpp =================================================================== --- lib/Parse/ParseExpr.cpp +++ lib/Parse/ParseExpr.cpp @@ -369,7 +369,7 @@ else RHS = ParseCastExpression(false); - if (RHS.isInvalid()) { + if (RHS.isInvalid() || isa(RHS.get())) { // FIXME: Errors generated by the delayed typo correction should be // printed before errors from parsing the RHS, not after. Actions.CorrectDelayedTyposInExpr(LHS); Index: test/SemaCXX/typo-correction-cxx11.cpp =================================================================== --- test/SemaCXX/typo-correction-cxx11.cpp +++ test/SemaCXX/typo-correction-cxx11.cpp @@ -19,8 +19,13 @@ namespace PR23140 { auto lneed = gned.*[] {}; // expected-error-re {{use of undeclared identifier 'gned'{{$}}}} -void test(int aaa, int bbb, int thisvar) { // expected-note {{'thisvar' declared here}} - int thatval = aaa * (bbb + thatvar); // expected-error {{use of undeclared identifier 'thatvar'; did you mean 'thisvar'?}} +void test(int aaa, int bbb, int thisvar) { + // expected-note@-1 {{'thisvar' declared here}} + int thatval = aaa * (bbb + thatvar); + // expected-error@-1 {{use of undeclared identifier 'thatvar'; did you mean 'thatval'?}} + // expected-note@-2 {{'thatval' declared here}} + int thatval2 = aaa * (bbb + thisval); + // expected-error@-1 {{use of undeclared identifier 'thisval'; did you mean 'thisvar'?}} } } Index: test/SemaCXX/typo-correction-delayed.cpp =================================================================== --- test/SemaCXX/typo-correction-delayed.cpp +++ test/SemaCXX/typo-correction-delayed.cpp @@ -208,8 +208,18 @@ // expected-error-re@-1 {{use of undeclared identifier 'N'{{$}}}} } +namespace PR26598 { +int main() { + (((str) ? str : str)) + // expected-error@-1 {{use of undeclared identifier 'str'}} + // expected-error@-2 {{use of undeclared identifier 'str'}} + // expected-error@-3 {{use of undeclared identifier 'str'}} +} +} + // PR 23285. This test must be at the end of the file to avoid additional, // unwanted diagnostics. // expected-error-re@+2 {{use of undeclared identifier 'uintmax_t'{{$}}}} // expected-error@+1 {{expected ';' after top level declarator}} unsigned int a = 0(uintmax_t + Index: test/SemaObjC/provisional-ivar-lookup.m =================================================================== --- test/SemaObjC/provisional-ivar-lookup.m +++ test/SemaObjC/provisional-ivar-lookup.m @@ -3,7 +3,7 @@ // rdar:// 8565343 @interface Foo { @private - int _foo; + int _foo; // expected-note {{'_foo' declared here}} int _foo2; } @property (readwrite, nonatomic) int foo, foo1, foo2, foo3; @@ -16,7 +16,7 @@ @synthesize foo1; - (void)setFoo:(int)value { - _foo = foo; // expected-error {{use of undeclared identifier 'foo'}} + _foo = foo; // expected-error {{use of undeclared identifier 'foo'; did you mean '_foo'}} } - (void)setFoo1:(int)value {