[clang-repl] value printing of calling functions with `void` return type ignores the call
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Reproducer 1:
```c++
clang-repl> 1
(int) 1
clang-repl> extern "C" int printf(const char*, ...);
clang-repl> void foo() { printf("foo()\n"); }
clang-repl> foo();
foo()
clang-repl> foo()
clang-repl> foo();
foo()
```
The call to `foo()` without the semicolon, `;`, does not invoke the function.
Reproducer 2:
```c++
clang-repl> int x = 10;
clang-repl> x
(int) 10
clang-repl> void bar() { x = 100; }
clang-repl> bar()
clang-repl> x
(int) 10
clang-repl> bar();
clang-repl> x
(int) 100
```
Expected behaviour: The function should be invoked, or at least there should be an error saying invalid code.
cc @vgvassilev
Contributor guide
Research direction
Start by reproducing both examples in clang-repl and trace how a void-returning call entered without a semicolon is parsed and evaluated. Find the existing clang-repl handling for value printing and add regression coverage for both reproducers. Done means the call executes, or invalid input produces a clear error instead of being silently ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 66/100