Skip to content

Commit d402f56

Browse files
cameroncusterCameron Custerweb-flow
authored
tests/infra: move to C++23 (std pins, g++-14 in CI, deducing this in test code) (#228)
* tests/infra: move to c++23 (std pins, g++-14 in CI, deducing this in tests) * [auto-verifier] verify commit d4f4327 * revert deducing this in member-function lambdas (gcc 14/15 bug PR118291) * [auto-verifier] verify commit 1e06376 * ci: drop installs of preinstalled packages (g++-14, shellcheck, nodejs, npm) --------- Co-authored-by: Cameron Custer <cam@augmentcode.com> Co-authored-by: GitHub <noreply@github.com>
1 parent 1986a8a commit d402f56

23 files changed

Lines changed: 88 additions & 81 deletions

.github/actions/setup/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ runs:
88
wget https://apt.llvm.org/llvm.sh
99
chmod +x llvm.sh
1010
sudo ./llvm.sh 22
11-
sudo apt-get update
1211
sudo apt-get install -y clang-format-22 clang-tidy-22
12+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
1313
clang-22 --version
1414
clang-format-22 --version
1515
clang-tidy-22 --version
16+
g++ --version

.github/workflows/programming_team_code_ci.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
- uses: actions/checkout@v1
1313
- name: Set up Python
1414
uses: actions/setup-python@v1
15+
- name: Make preinstalled g++-14 the default g++
16+
run: |
17+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
18+
g++ --version
1519
- name: Install dependencies
1620
run: |
1721
pip install "setuptools<81"
@@ -53,6 +57,10 @@ jobs:
5357
runs-on: ubuntu-latest
5458
steps:
5559
- uses: actions/checkout@v4
60+
- name: Make preinstalled g++-14 the default g++
61+
run: |
62+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
63+
g++ --version
5664
- name: g++ with gcc
5765
run: make --directory=tests/ compile_gcc
5866

@@ -76,8 +84,8 @@ jobs:
7684
steps:
7785
- uses: actions/checkout@v4
7886
- uses: ./.github/actions/setup
79-
- name: Install texlive, rename, nodejs, npm
80-
run: sudo apt install texlive texlive-latex-extra rename nodejs npm
87+
- name: Install texlive, rename
88+
run: sudo apt install texlive texlive-latex-extra rename
8189
- name: build pdf
8290
run: make --directory=tests/ build_pdf
8391
- uses: actions/upload-artifact@v4
@@ -127,6 +135,6 @@ jobs:
127135
steps:
128136
- uses: actions/checkout@v4
129137
- name: Install dependencies
130-
run: sudo apt install shfmt shellcheck
138+
run: sudo apt install shfmt
131139
- name: shellcheck, shfmt
132140
run: make --directory=tests/ shellcheck_shfmt

.verify-helper/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CXX = "g++"
33
CXXFLAGS = [
44
"-O2",
5-
"-std=c++20",
5+
"-std=c++23",
66
"-fsanitize=address,undefined",
77
"-fno-sanitize-recover=all",
88
"-fstack-protector",

.verify-helper/timestamps.remote.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-07-06 13:10:16 -0700",
3131
"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-07-06 13:10:16 -0700",
3232
"tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2026-07-06 13:10:16 -0700",
33-
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-06 13:10:16 -0700",
33+
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-06 22:18:09 -0700",
3434
"tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2026-07-06 13:10:16 -0700",
3535
"tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2026-07-06 13:10:16 -0700",
3636
"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -49,7 +49,7 @@
4949
"tests/library_checker_aizu_tests/dsu/dsu_bipartite.test.cpp": "2026-07-06 13:10:16 -0700",
5050
"tests/library_checker_aizu_tests/dsu/dsu_weighted_aizu.test.cpp": "2026-07-06 13:49:19 -0700",
5151
"tests/library_checker_aizu_tests/dsu/dsu_weighted_lib_checker.test.cpp": "2026-07-06 13:49:19 -0700",
52-
"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
52+
"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-06 22:18:09 -0700",
5353
"tests/library_checker_aizu_tests/dsu/line_tree_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
5454
"tests/library_checker_aizu_tests/dsu/line_tree_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
5555
"tests/library_checker_aizu_tests/dsu/range_parallel_dsu.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -62,7 +62,7 @@
6262
"tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2026-07-06 13:10:16 -0700",
6363
"tests/library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp": "2026-07-06 13:10:16 -0700",
6464
"tests/library_checker_aizu_tests/graphs/dijkstra_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
65-
"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
65+
"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-06 22:18:09 -0700",
6666
"tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2026-07-06 13:10:16 -0700",
6767
"tests/library_checker_aizu_tests/graphs/enumerate_triangles.test.cpp": "2026-07-06 13:10:16 -0700",
6868
"tests/library_checker_aizu_tests/graphs/euler_walk_directed.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -74,11 +74,11 @@
7474
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
7575
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
7676
"tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2026-07-06 13:10:16 -0700",
77-
"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 13:10:16 -0700",
78-
"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-06 13:10:16 -0700",
79-
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 13:10:16 -0700",
77+
"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 22:18:09 -0700",
78+
"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-06 22:18:09 -0700",
79+
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 22:18:09 -0700",
8080
"tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2026-07-06 13:10:16 -0700",
81-
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-06 13:10:16 -0700",
81+
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-06 22:43:37 -0700",
8282
"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-07-06 13:10:16 -0700",
8383
"tests/library_checker_aizu_tests/handmade_tests/kd_bit.test.cpp": "2026-07-06 13:10:16 -0700",
8484
"tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -92,7 +92,7 @@
9292
"tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2026-07-06 13:10:16 -0700",
9393
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-07-06 13:10:16 -0700",
9494
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-07-06 13:10:16 -0700",
95-
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-06 13:10:16 -0700",
95+
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-06 22:18:09 -0700",
9696
"tests/library_checker_aizu_tests/handmade_tests/xor_basis_walk.test.cpp": "2026-07-06 13:10:16 -0700",
9797
"tests/library_checker_aizu_tests/loops/chooses.test.cpp": "2026-07-06 13:10:16 -0700",
9898
"tests/library_checker_aizu_tests/loops/quotients.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -132,11 +132,11 @@
132132
"tests/library_checker_aizu_tests/strings/suffix_array_short.test.cpp": "2026-04-12 06:15:25 -0600",
133133
"tests/library_checker_aizu_tests/strings/trie.test.cpp": "2026-07-06 13:10:16 -0700",
134134
"tests/library_checker_aizu_tests/strings/wildcard_pattern_matching.test.cpp": "2026-07-06 13:10:16 -0700",
135-
"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 13:10:16 -0700",
136-
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 13:10:16 -0700",
137-
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 13:10:16 -0700",
138-
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 13:10:16 -0700",
139-
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 13:10:16 -0700",
135+
"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700",
136+
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 22:43:37 -0700",
137+
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 22:43:37 -0700",
138+
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700",
139+
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 22:18:09 -0700",
140140
"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-06 13:10:16 -0700",
141141
"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-06 13:10:16 -0700",
142142
"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -148,7 +148,7 @@
148148
"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-07-06 13:10:16 -0700",
149149
"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
150150
"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
151-
"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 13:10:16 -0700",
152-
"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 13:10:16 -0700",
151+
"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 22:18:09 -0700",
152+
"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 22:18:09 -0700",
153153
"tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2026-07-06 13:10:16 -0700"
154154
}

tests/.config/.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,5 @@ SpacesInCStyleCastParentheses: false
8888
SpacesInContainerLiterals: false
8989
SpacesInParentheses: false
9090
SpacesInSquareBrackets: false
91-
Standard: c++20
91+
Standard: Latest
9292
...

tests/.config/.gcc_compile_flags

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
-Wduplicated-cond
1111
-Werror
1212
-O2
13-
-std=c++20
13+
-std=c++23

tests/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
help:
22
@echo "command | explanation"
33
@echo "------------------------------------ | -----------"
4-
@echo "make compile_gcc | compile all tests with -std=c++20 for warnings"
4+
@echo "make compile_gcc | compile all tests with -std=c++23 for warnings"
55
@echo " |"
6-
@echo "make compile_clang | compile all tests with clang, -std=c++20 for warnings"
6+
@echo "make compile_clang | compile all tests with clang, -std=c++23 for warnings"
77
@echo " |"
88
@echo "make grep_clangformat_cppcheck | various greps to catch certain things, clang-format, cppcheck"
99
@echo " |"

tests/library_checker_aizu_tests/cd_asserts.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ void cd_asserts(vector<vi> adj) {
55
vi naive_par_decomp(sz(adj), -1);
66
vi par = cd(adj, [&](int cent) -> void {
77
assert(decomp_size[cent] == -1);
8-
auto dfs = [&](auto&& self, int u, int p) -> int {
8+
auto dfs = [&](this auto&& self, int u, int p) -> int {
99
if (p != -1) naive_par_decomp[u] = cent;
1010
int sub_size = 1;
1111
for (int v : adj[u])
12-
if (v != p) sub_size += self(self, v, u);
12+
if (v != p) sub_size += self(v, u);
1313
return sub_size;
1414
};
15-
decomp_size[cent] = dfs(dfs, cent, -1);
15+
decomp_size[cent] = dfs(cent, -1);
1616
for (int u : adj[cent]) {
17-
int sz_subtree = dfs(dfs, u, cent);
17+
int sz_subtree = dfs(u, cent);
1818
assert(1 <= sz_subtree &&
1919
2 * sz_subtree <= decomp_size[cent]);
2020
}

tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ int main() {
1515
cout << sz(ch) << '\n';
1616
int curr_time = 0;
1717
vi node_to_time(sz(ch), -1);
18-
auto dfs = [&](auto&& self, int u, int p) -> void {
18+
auto dfs = [&](this auto&& self, int u, int p) -> void {
1919
node_to_time[u] = curr_time++;
2020
cout << (p == -1 ? p : node_to_time[p]) << " "
2121
<< pt.p[u].mn_idx << " "
2222
<< pt.p[u].mn_idx + pt.p[u].len - 1 << " "
2323
<< (pt.p[u].is_join || empty(ch[u]) ? "linear"
2424
: "prime")
2525
<< '\n';
26-
for (int v : ch[u]) self(self, v, u);
26+
for (int v : ch[u]) self(v, u);
2727
};
28-
dfs(dfs, root, -1);
28+
dfs(root, -1);
2929
return 0;
3030
}

tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ int main() {
3030
rep(i, n, kt.id) mst_sum += weight[i];
3131
vi depth(2 * n);
3232
vi actual_par(2 * n, -1);
33-
auto dfs = [&](auto&& self, int v) -> void {
33+
auto dfs = [&](this auto&& self, int v) -> void {
3434
for (int u : kt.g[v]) {
3535
depth[u] = 1 + depth[v];
3636
actual_par[u] = v;
37-
self(self, u);
37+
self(u);
3838
}
3939
};
40-
dfs(dfs, kt.id - 1);
40+
dfs(kt.id - 1);
4141
rep(i, 0, n) rep(j, i + 1, n) {
4242
int u = i, v = j;
4343
while (u != v)

0 commit comments

Comments
 (0)