# BRiCk C++ semantics

> A separation-logic semantics of a large part of C++, written as weakest-precondition rules in Rocq on top of Iris. It is the model behind the BRiCk toolchain.

- Kind: formal semantics
- Models: C++ (C++ as parsed by Clang 20 to 23; the documentation names no single C++ standard version.)
- Fragment: C++ as seen through Clang's syntax tree, after template instantiation: classes, virtual calls, constructors and destructors, sequentially consistent atomics and IEEE floats. Not covered: exceptions, coroutines, virtual inheritance, member pointer operators, inline assembly, relaxed atomics and initialization of globals. The features page lists every gap.
- Written in: Rocq (Iris separation logic)
- Available in: Rocq
- Stage: 0 (Mechanized)
- Licence: open-source, LGPL-2.1 with the BedRock network-use addendum (LICENSE-BedRock)
- Validation: No published validation against compilers or conformance tests was found. The rules are stated as about 450 Rocq axioms, so they cannot be run on programs. A model of parts of the axioms exists, with 8 lemmas still unproved (Admitted). The project keeps its own regression tests, and known soundness bugs are tracked publicly with a "soundness" label.
- Latest release: main@5d7dacc (2026-11-26) https://github.com/SkyLabsAI/BRiCk/commits/main
- Used by toolchains: brick

## Stage

**Stage 0: Mechanized.**

| Stage | Criterion | Met | Evidence / note |
|---|---|---|---|
| 0 | Machine-checked or machine-readable definition | yes | [evidence](https://github.com/SkyLabsAI/BRiCk/tree/main/rocq-skylabs-brick/theories/lang/cpp) |
| 0 | Fragment and version are stated | yes | [evidence](https://skylabsai.github.io/BRiCk/features.html) The features page lists supported and unsupported constructs as of October 2026, relative to Clang's syntax tree. It names no C++ standard version. |
| 1 | Can be executed or tested | no | The semantics is a set of axioms in weakest-precondition style; it cannot run programs. |
| 1 | Published results against conformance tests or real implementations | no | No published conformance or differential-testing results. |
| 2 | Adopted by the language or ISA owner, or covers the full current version and tracks new ones | no | Adopted by the owner: no; full coverage: no; tracks new versions: no. Not adopted or endorsed by the ISO C++ committee. Exceptions, coroutines, virtual inheritance and other features are not covered. No stated policy for new C++ versions. cpp2v does follow new Clang releases (Clang 23 support added 2026-11-05). |

Missing for Stage 1: Can be executed or tested; Published results against conformance tests or real implementations.

## Common features

| Feature | Coverage |
|---|---|
| Machine integers | Supported — All integer types are modeled by size and signedness; the sizes come from the Clang target. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Floating point | Partial — IEEE-754 half, single, double and quad precision via the Flocq library; x87 long double is abstract. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Heap and pointers | Supported — new, delete, pointers and pointer provenance are modeled; reinterpret_cast has no rule yet. ([source](https://skylabsai.github.io/BRiCk/pointers.html)) |
| Arrays and buffers | Partial — Implicit copy assignment of byte arrays has no working rule; variable-length arrays and flexible array members (compiler extensions) are not supported. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Loops | Supported |
| Recursion | Unknown — The documentation we found does not discuss recursive functions. |
| Higher-order code | Partial — Calls through function pointers are modeled; calls through member function pointers are not. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Threads and shared memory | Partial — Concurrency is modeled, but only sequentially consistent atomics; weak memory is planned. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| I/O and system calls | Partial — No model of I/O or system calls; calls to outside functions (including variadic ones such as printf) are given specifications by the user. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Standard library | Partial — The standard library is not part of the semantics; the separate brick-libcpp project specifies parts of it. ([source](https://github.com/SkyLabsAI/brick-libcpp)) |

## C++-specific features

| Feature | Coverage |
|---|---|
| Classes and virtual calls | Partial — Classes, inheritance and virtual dispatch are modeled. Virtual inheritance is not; classes with bit-fields are opaque; dynamic_cast and typeid are partial. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Templates | Partial — Only instantiated templates are modeled; parameter packs and unresolved concepts are not. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Constructors and destructors | Partial — Constructors, destructors and implicit destruction are modeled; lifetime-extended temporaries and initialization of globals are not. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Exceptions | Not supported — throw and try are not modeled, and calls are assumed not to throw. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Standard library (STL) | Partial — Not part of the semantics; brick-libcpp specifies parts of the standard library. ([source](https://github.com/SkyLabsAI/brick-libcpp)) |
| Lambdas | Partial — cpp2v translates lambdas, but lambda types at global scope are dropped as unsupported. ([source](https://github.com/SkyLabsAI/BRiCk/blob/main/CHANGES.md)) |

## Sources
- [BRiCk repository](https://github.com/SkyLabsAI/BRiCk)
- [BRiCk language support](https://skylabsai.github.io/BRiCk/features.html)
- [BRiCk evaluation rules](https://skylabsai.github.io/BRiCk/evaluation.html)
- [BRiCk compiler correctness](https://skylabsai.github.io/BRiCk/machine.html)
- [BRiCk related work](https://skylabsai.github.io/BRiCk/bibliography.html)
- [BRiCk changelog](https://github.com/SkyLabsAI/BRiCk/blob/main/CHANGES.md)

---
Last checked 2026-11-26. Data: [JSON](/semantics/brick-cpp.json) · Page: [HTML](/semantics/brick-cpp/) · Methodology v0.1: [/methodology/](/methodology/) · Corrections: [/contribute/](/contribute/)
