Index: clang/lib/Interpreter/IncrementalParser.cpp =================================================================== --- clang/lib/Interpreter/IncrementalParser.cpp +++ clang/lib/Interpreter/IncrementalParser.cpp @@ -188,7 +188,7 @@ S.TUScope->setEntity(PreviousTU); // Clean up the lookup table - if (StoredDeclsMap *Map = PreviousTU->getLookupPtr()) { + if (StoredDeclsMap *Map = PreviousTU->getPrimaryContext()->getLookupPtr()) { for (auto I = Map->begin(); I != Map->end(); ++I) { StoredDeclsList &List = I->second; DeclContextLookupResult R = List.getLookupResult(); Index: clang/test/Interpreter/errorRecovery.cpp =================================================================== --- /dev/null +++ clang/test/Interpreter/errorRecovery.cpp @@ -0,0 +1,16 @@ +// RUN: clang-repl "int x = 12;" 'extern "C" int printf(const char*,...);' \ +// RUN: 'auto r1 = printf("x = %d\n", x);' | FileCheck --check-prefix=CHECK-DRIVER %s +// REQUIRES: host-supports-jit +// UNSUPPORTED: system-aix +// CHECK-DRIVER: x = 12 +// RUN: cat %s | clang-repl | FileCheck %s +extern "C" int printf(const char *, ...); +int x = 5; +auto r1 = printf("x = %d\n", x); +// CHECK: x = 5 + +int y = 10; err; +int y = 11; +auto r2 = printf("y = %d\n", y); +// CHECK-NEXT: y = 11 +quit