Test clang-repl 20 Safely and Spot an Incomplete Build
You will verify what the installed clang-repl-20 actually does, run a harmless smoke test, and distinguish a working C++ interpreter from a package that only exposes the command-line shell. This matters on systems where the executable reports success but does not execute the input. Allow about ten minutes. You need a shell and the clang-tools-20 package; none of the checks below needs sudo.
The route
Jump straight to the step you need, or tick off Done means at the end.
1. Confirm the installed command and package
Start by checking the path and the version. The local package used for these examples is Debian's clang-tools-20, version 1:20.1.8~++20250804090239+87f0227cb601-1~exp1~20250804210352.139. The executable identifies itself as LLVM 20.1.8.
$ command -v clang-repl-20
/usr/bin/clang-repl-20
$ clang-repl-20 --version
Ubuntu LLVM version 20.1.8
Optimized build.
The installed manual page is for clang-repl 20 and documents the usage form clang-repl [options] [code to run]. Its option list is largely the common Clang and LLVM option set. It does not provide a separate tutorial, input grammar or guarantee that every advertised interpreter feature is enabled in this particular build.
Checkpoint
You should have a versioned executable at a known path before testing any C++ input.
2. Run a harmless version-only check
--version only prints metadata and does not compile or execute code. It is the safest first command when diagnosing a machine you did not configure yourself:
$ clang-repl-20 --version
Ubuntu LLVM version 20.1.8
Optimized build.
Do not infer interpreter support from this output. A version string proves that the executable started, not that the incremental compiler and JIT can process input.
3. Feed one small expression on standard input
The upstream LLVM documentation describes Clang-Repl as an interactive C++ interpreter. It shows a prompt named clang-repl>, automatic printing for an expression without a semicolon, and special commands such as %help and %quit. Test the smallest useful expression through standard input, without creating or changing a file:
$ printf '%s\n' '1 + 2' | clang-repl-20
Not implement yet.
On the installed 20.1.8 package used for this guide, that output is the result of the smoke test. The process returns status 0, but it does not print the expected value 3. Treat this as a failed capability check even though the shell status is successful.
Capture the status immediately if a script needs to record it:
$ set +e
$ printf '%s\n' '1 + 2' | clang-repl-20
Not implement yet.
$ status=$?
$ printf 'clang-repl exit status: %s\n' "$status"
clang-repl exit status: 0
The distinction is useful: a zero status here means the process completed its current implementation path. It is not proof that the expression was evaluated.
4. Do not mistake command-line options for REPL commands
The manpage documents long options such as --help, --version, the output-colour switch, and --Xcc=<string>. These are process options and must be supplied to the executable. The upstream documentation's percent-prefixed commands are input understood by a functioning REPL, not shell options.
For example, this checks whether the installed executable exposes a usable help path:
$ clang-repl-20 --help | sed -n '1,12p'
USAGE: clang-repl-20 [options] [code to run]
OPTIONS:
Color Options:
--color - Use colors in output (default=autodetect)
Do not use %help as a substitute for --help in an automated shell test. On this installed command it is parsed as input rather than handled as a built-in command, and the output includes a parsing error.
5. Decide whether the package is suitable
If the expression test prints 3 or another evaluated result, you can continue with interactive C++ experiments. Start with declarations and expressions that do not access the filesystem, network, credentials or production services. Keep each session disposable; the interpreter executes native code, so pasted C++ has the same trust boundary as a compiled helper program.
If the result is Not implement yet., stop treating this executable as a working REPL. Record the exact version, package version, command path and smoke-test output. Check your distribution's package tracker or LLVM packaging notes, then compare against a package or build that includes the interpreter implementation. Do not work around the result by passing random compiler flags: --Xcc forwards an argument to Clang's compiler invocation, but it cannot add missing interpreter code.
For a locally built LLVM checkout, the official documentation gives a build route that enables the Clang project and builds the clang-repl target. Keep that build separate from the system package until its smoke test succeeds. A replacement may change compiler discovery, ABI assumptions and library search paths, so it is not a harmless system-wide upgrade.
6. Keep the diagnostic reproducible
Save text output rather than changing the system while you investigate:
$ {
> command -v clang-repl-20
> clang-repl-20 --version
> printf '%s\n' '1 + 2' | clang-repl-20
> } 2>&1 | tee clang-repl-smoke.log
/usr/bin/clang-repl-20
Ubuntu LLVM version 20.1.8
Optimized build.
Not implement yet.
The log is ordinary diagnostic data. Remove it when it is no longer needed with rm -- clang-repl-smoke.log; that deletion is irreversible, so copy it to your issue tracker first if the package needs investigation. No elevated privileges are required for either action.
Done means
- The executable path, LLVM version and installed package version are recorded.
- A harmless expression was tested through standard input.
- You checked the output as well as the exit status.
Not implement yet.is treated as an incomplete interpreter, not as successful evaluation.- Any replacement build is isolated until its own smoke test prints an evaluated result.