[clang] [clang-repl] Address error recovery fixing infinite loop while parsing (PR #127569)

Anutosh Bhat via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 11 00:08:08 PST 2026


anutosh491 wrote:

Can already point out 4 examples being generated from 4 different locations and now fixed 
```
anutosh491 at vv-nuc:/build/anutosh491/llvm-project/build/bin$ ./clang-repl

clang-repl> void foo() { int x = 5;
<<< inputs >>>:1:1: error: expected '}'
input_line_1:1:12: note: to match this '{'
    1 | void foo() { int x = 5;
      |            ^
error: Parsing failed.

clang-repl> void (*test)() = [](){ if }
input_line_2:1:27: error: expected '(' after 'if'
    1 | void (*test)() = [](){ if }
      |                           ^
<<< inputs >>>:1:1: error: expected '}'
input_line_2:1:22: note: to match this '{'
    1 | void (*test)() = [](){ if }
      |                      ^
input_line_2:1:28: error: expected ';' after top level declarator
    1 | void (*test)() = [](){ if }
      |                            ^
      |                            ;
error: Parsing failed.

clang-repl> namespace myspace {
<<< inputs >>>:1:1: error: expected '}'
input_line_3:1:19: note: to match this '{'
    1 | namespace myspace {
      |                   ^
error: Parsing failed.

clang-repl> struct X { using type = int };
input_line_4:1:28: error: expected ';' after alias declaration
    1 | struct X { using type = int };
      |                            ^
      |                            ;
<<< inputs >>>:1:1: error: expected '}'
input_line_4:1:10: note: to match this '{'
    1 | struct X { using type = int };
      |          ^
input_line_4:1:31: error: expected ';' after struct
    1 | struct X { using type = int };
      |                               ^
      |                               ;
error: Parsing failed.
```

This issue https://github.com/compiler-research/xeus-cpp/issues/442 also ended up being related and should be fixed through this !

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


More information about the cfe-commits mailing list