[clang] [clang-repl] Fix crashing on unusable top-level declarations (PR #230054)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 05:17:36 PDT 2026


================
@@ -596,6 +596,20 @@ TEST_F(InterpreterTest, TranslationUnit_CanonicalDecl) {
             sema.getASTContext().getTranslationUnitDecl()->getCanonicalDecl());
 }
 
+TEST_F(InterpreterTest, UnusableTopLevelDecl) {
+  std::vector<const char *> Args;
+  std::unique_ptr<Interpreter> Interp = createInterpreter(Args);
+
+  Value V;
+
+  llvm::cantFail(Interp->ParseAndExecute("return;", &V));
----------------
vgvassilev wrote:

Is this reachable via lit-level test?

https://github.com/llvm/llvm-project/pull/230054


More information about the cfe-commits mailing list