Skip to content

Commit ef988ae

Browse files
authored
Merge pull request #34 from zeus-cpp/fix/conformance
Fix expected construction and exception safety
2 parents 38827dd + 71360d8 commit ef988ae

19 files changed

Lines changed: 1690 additions & 195 deletions

‎.github/workflows/sanitizers.yml‎

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Sanitizers
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- ci/**
9+
pull_request:
10+
branches:
11+
- main
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
test-on-msvc:
18+
strategy:
19+
fail-fast: false
20+
21+
matrix:
22+
build-type: [Debug, Release]
23+
include:
24+
- build-type: Debug
25+
cmake-preset: conan-debug
26+
- build-type: Release
27+
cmake-preset: conan-release
28+
29+
name: MSVC v143 - ASan - ${{ matrix.build-type }}
30+
31+
runs-on: windows-2022
32+
33+
steps:
34+
- uses: actions/checkout@v7
35+
36+
- name: Setup MSVC developer environment
37+
uses: TheMrMilchmann/setup-msvc-dev@v4
38+
with:
39+
arch: x64
40+
41+
- name: Install Conan
42+
uses: turtlebrowser/get-conan@main
43+
44+
- name: Setup Conan
45+
run: |
46+
conan --version
47+
conan profile detect
48+
49+
- name: Install CMake
50+
uses: lukka/get-cmake@latest
51+
52+
- name: Install dependencies
53+
run: >
54+
conan install .
55+
-c tools.microsoft.msbuild:vs_version=17
56+
-s compiler.version=194
57+
-s compiler.cppstd=23
58+
-s build_type=${{ matrix.build-type }}
59+
-b missing
60+
61+
- name: CMake Configure
62+
run: >
63+
cmake --preset conan-default
64+
-DZEUS_EXPECTED_TEST_ASAN_REQUIRED=ON
65+
66+
- name: Build
67+
run: cmake --build --preset ${{ matrix.cmake-preset }}
68+
69+
- name: Test
70+
run: ctest --preset ${{ matrix.cmake-preset }} --output-on-failure
71+
72+
test-on-linux:
73+
strategy:
74+
fail-fast: false
75+
76+
matrix:
77+
compiler:
78+
- name: GCC 15
79+
id: gcc
80+
version: 15
81+
cc: gcc-15
82+
cxx: g++-15
83+
- name: Clang 22
84+
id: clang
85+
version: 22
86+
cc: clang-22
87+
cxx: clang++-22
88+
build-type: [Debug, Release]
89+
include:
90+
- build-type: Debug
91+
cmake-preset: conan-debug
92+
- build-type: Release
93+
cmake-preset: conan-release
94+
95+
name: ${{ matrix.compiler.name }} - ASan + UBSan - ${{ matrix.build-type }}
96+
97+
runs-on: ubuntu-24.04
98+
99+
env:
100+
CC: ${{ matrix.compiler.cc }}
101+
CXX: ${{ matrix.compiler.cxx }}
102+
103+
steps:
104+
- uses: actions/checkout@v7
105+
106+
- name: Setup GCC
107+
if: matrix.compiler.id == 'gcc'
108+
uses: egor-tensin/setup-gcc@v2
109+
with:
110+
version: ${{ matrix.compiler.version }}
111+
112+
- name: Setup Clang
113+
if: matrix.compiler.id == 'clang'
114+
uses: egor-tensin/setup-clang@v2
115+
with:
116+
version: ${{ matrix.compiler.version }}
117+
118+
- name: Install Conan
119+
uses: turtlebrowser/get-conan@main
120+
121+
- name: Setup Conan
122+
run: |
123+
conan --version
124+
conan profile detect --force
125+
126+
- name: Install CMake
127+
uses: lukka/get-cmake@latest
128+
129+
- name: Install dependencies
130+
run: >
131+
conan install .
132+
-s compiler.cppstd=23
133+
-s build_type=${{ matrix.build-type }}
134+
-b missing
135+
136+
- name: CMake Configure
137+
run: >
138+
cmake --preset ${{ matrix.cmake-preset }}
139+
-DZEUS_EXPECTED_TEST_ASAN_REQUIRED=ON
140+
-DZEUS_EXPECTED_TEST_UBSAN_REQUIRED=ON
141+
142+
- name: Build
143+
run: cmake --build --preset ${{ matrix.cmake-preset }}
144+
145+
- name: Test
146+
run: ctest --preset ${{ matrix.cmake-preset }} --output-on-failure

‎.github/workflows/tests.yml‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
runs-on: windows-2022
3838

3939
steps:
40-
- uses: actions/checkout@v4
40+
- uses: actions/checkout@v7
4141

4242
- name: Install Conan
4343
uses: turtlebrowser/get-conan@main
@@ -62,7 +62,7 @@ jobs:
6262
- name: CMake Configure
6363
run: |
6464
cmake --list-presets
65-
cmake --preset conan-default
65+
cmake --preset conan-default -DZEUS_EXPECTED_TEST_ASAN_AUTO=OFF -DZEUS_EXPECTED_TEST_UBSAN_AUTO=OFF
6666
6767
- name: Build
6868
run: |
@@ -99,7 +99,7 @@ jobs:
9999
runs-on: ${{ matrix.gcc.os }}
100100

101101
steps:
102-
- uses: actions/checkout@v4
102+
- uses: actions/checkout@v7
103103

104104
- name: Setup GCC
105105
if: matrix.gcc.version == 15
@@ -134,7 +134,7 @@ jobs:
134134
- name: CMake Configure
135135
run: |
136136
cmake --list-presets
137-
cmake --preset ${{ matrix.cmake-preset }}
137+
cmake --preset ${{ matrix.cmake-preset }} -DZEUS_EXPECTED_TEST_ASAN_AUTO=OFF -DZEUS_EXPECTED_TEST_UBSAN_AUTO=OFF
138138
139139
- name: Build
140140
run: |
@@ -185,7 +185,7 @@ jobs:
185185
python3-pip \
186186
unzip
187187
188-
- uses: actions/checkout@v4
188+
- uses: actions/checkout@v7
189189

190190
- name: Check GCC Version
191191
run: |
@@ -214,7 +214,7 @@ jobs:
214214
- name: CMake Configure
215215
run: |
216216
cmake --list-presets
217-
cmake --preset ${{ matrix.cmake-preset }}
217+
cmake --preset ${{ matrix.cmake-preset }} -DZEUS_EXPECTED_TEST_ASAN_AUTO=OFF -DZEUS_EXPECTED_TEST_UBSAN_AUTO=OFF
218218
219219
- name: Build
220220
run: |
@@ -252,7 +252,7 @@ jobs:
252252
CXX: clang++-${{ matrix.clang-version }}
253253

254254
steps:
255-
- uses: actions/checkout@v4
255+
- uses: actions/checkout@v7
256256

257257
- name: Install Clang
258258
uses: egor-tensin/setup-clang@v2
@@ -294,7 +294,7 @@ jobs:
294294
- name: CMake Configure
295295
run: |
296296
cmake --list-presets
297-
cmake --preset ${{ matrix.cmake-preset }}
297+
cmake --preset ${{ matrix.cmake-preset }} -DZEUS_EXPECTED_TEST_ASAN_AUTO=OFF -DZEUS_EXPECTED_TEST_UBSAN_AUTO=OFF
298298
299299
- name: Build
300300
run: |
@@ -326,7 +326,7 @@ jobs:
326326
runs-on: ${{ matrix.os }}
327327

328328
steps:
329-
- uses: actions/checkout@v4
329+
- uses: actions/checkout@v7
330330

331331
- name: Setup GCC
332332
uses: egor-tensin/setup-gcc@v1
@@ -360,7 +360,7 @@ jobs:
360360
- name: CMake Configure
361361
run: |
362362
cmake --list-presets
363-
cmake --preset ${{ matrix.cmake-preset }}
363+
cmake --preset ${{ matrix.cmake-preset }} -DZEUS_EXPECTED_TEST_ASAN_AUTO=OFF -DZEUS_EXPECTED_TEST_UBSAN_AUTO=OFF
364364
365365
- name: Build
366366
run: |

‎README.md‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![GitHub Release](https://img.shields.io/github/v/release/zeus-cpp/expected?color=green)](https://github.com/zeus-cpp/expected/releases)
55
[![Conan Center](https://img.shields.io/conan/v/zeus_expected)](https://conan.io/center/recipes/zeus_expected)
66

7-
Backporting `std::expected` to C++17.
7+
A C++17 backport of `std::expected`, designed for API compatibility with the standard library.
88

99
## Features
1010

@@ -32,18 +32,17 @@ Enhancements:
3232

3333
+ Enhanced noexcept (covered by tests from MSVC's STL)
3434

35-
## Compiler supports
35+
## Compiler support
3636

37-
Any compiler that supports C++17 should work.
37+
A conforming C++17 implementation is required. Higher language standards are also supported and can provide benefits such as enhanced constexpr capabilities.
3838

39-
Higher language standards are also supported, which can provide benefits such as enhanced constexpr capabilities.
39+
| Compiler | Supported versions |
40+
| --- | --- |
41+
| MSVC | v142 and later |
42+
| GCC | 8 and later |
43+
| Clang | 11 and later |
4044

41-
List of known compiler supported:
42-
43-
+ MSVC v142 and later
44-
+ GCC 8 and later
45-
46-
Feedbacks are welcome.
45+
See the [CI workflow](.github/workflows/tests.yml) for the compiler and language standard combinations that are continuously tested. Other conforming compilers may also work. Feedback is welcome.
4746

4847
## Building and testing
4948

0 commit comments

Comments
 (0)