<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/146770>146770</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-repl Typing an error in a formula may be followed by an unresolved while linking error
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
guitargeek
</td>
</tr>
</table>
<pre>
In some cases, `clang-repl` doesn't recover correctly from input errors, resulting in a state where unexpected linker errors can happen in correct statements given afterwards.
It seems that this kind of error occurs only with "pow".
@vgvassilev @Vipul-Cariappa
Reproducer (I ran it with the LLVM 20 packages in NixOS):
```txt
LLVM (http://llvm.org/):
LLVM version 20.1.6
Optimized build.
```
```txt
clang-repl> #include <iostream>
clang-repl> #include <cmath>
clang-repl> (10-)*std::pow(2,2);
In file included from <<< inputs >>>:1:
input_line_3:1:5: error: expected expression
1 | (10-)*std::pow(2,2);
| ^
error: Parsing failed.
clang-repl> std::cout << ((10-1)*std::pow(2,2)) << std::endl;
JIT session error: Symbols not found: [ _ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_ ]
error: Failed to materialize symbols: { (main, { $.incr_module_3.__inits.0, __orc_init_func.incr_module_3 }) }
clang-repl>
```
What is expected:
```txt
clang-repl> #include <iostream>
clang-repl> #include <cmath>
clang-repl> (10-)*std::pow(2,2);
In file included from <<< inputs >>>:1:
input_line_3:1:5: error: expected expression
1 | (10-)*std::pow(2,2);
| ^
error: Parsing failed.
clang-repl> std::cout << ((10-1)*std::pow(2,2)) << std::endl;
36
clang-repl>
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsVk1v4zYT_jX0ZRCDoizJPujgOA7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