Skip to content

Commit abd2158

Browse files
authored
Merge pull request #2 from steve-downey/merge-upstream
Merge upstream: sync with bemanproject/sandbox-expected
2 parents a3dd6f4 + 47c5372 commit abd2158

15 files changed

Lines changed: 166 additions & 205 deletions

.beman-tidy.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
# Check documentation for beman-tidy here:
55
# https://github.com/bemanproject/beman-tidy/blob/main/README.md
66

7-
disabled_rules:
8-
# None
9-
ignored_paths:
10-
# None
7+
disabled_rules: []
8+
ignored_paths: []

.github/workflows/ci_tests.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
}
6363
]
6464
},
65-
{ "cxxversions": ["c++20", "c++17"],
65+
{ "cxxversions": ["c++20"],
6666
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
6767
}
6868
]
@@ -78,22 +78,22 @@ jobs:
7878
}
7979
]
8080
},
81-
{ "cxxversions": ["c++20", "c++17"],
81+
{ "cxxversions": ["c++20"],
8282
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
8383
}
8484
]
8585
},
8686
{ "versions": ["14", "13"],
8787
"tests": [
88-
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
88+
{ "cxxversions": ["c++26", "c++23", "c++20"],
8989
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
9090
}
9191
]
9292
},
9393
{
9494
"versions": ["12", "11"],
9595
"tests": [
96-
{ "cxxversions": ["c++23", "c++20", "c++17"],
96+
{ "cxxversions": ["c++23", "c++20"],
9797
"tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
9898
}
9999
]
@@ -122,7 +122,7 @@ jobs:
122122
}
123123
]
124124
},
125-
{ "cxxversions": ["c++20", "c++17"],
125+
{ "cxxversions": ["c++20"],
126126
"tests": [
127127
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
128128
]
@@ -131,7 +131,7 @@ jobs:
131131
},
132132
{ "versions": ["21", "20", "19"],
133133
"tests": [
134-
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
134+
{ "cxxversions": ["c++26", "c++23", "c++20"],
135135
"tests": [
136136
{"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]}
137137
]
@@ -140,20 +140,20 @@ jobs:
140140
},
141141
{ "versions": ["18"],
142142
"tests": [
143-
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
143+
{ "cxxversions": ["c++26", "c++23", "c++20"],
144144
"tests": [{"stdlibs": ["libc++"], "tests": ["Release.Default"]}]
145145
},
146-
{ "cxxversions": ["c++23", "c++20", "c++17"],
146+
{ "cxxversions": ["c++23", "c++20"],
147147
"tests": [{"stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
148148
}
149149
]
150150
},
151151
{ "versions": ["17"],
152152
"tests": [
153-
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
153+
{ "cxxversions": ["c++26", "c++23", "c++20"],
154154
"tests": [{"stdlibs": ["libc++"], "tests": ["Release.Default"]}]
155155
},
156-
{ "cxxversions": ["c++20", "c++17"],
156+
{ "cxxversions": ["c++20"],
157157
"tests": [{"stdlibs": ["libstdc++"], "tests": ["Release.Default"]}]
158158
}
159159
]
@@ -162,7 +162,7 @@ jobs:
162162
"appleclang": [
163163
{ "versions": ["latest"],
164164
"tests": [
165-
{ "cxxversions": ["c++26", "c++23", "c++20", "c++17"],
165+
{ "cxxversions": ["c++26", "c++23", "c++20"],
166166
"tests": [{ "stdlibs": ["libc++"], "tests": ["Release.Default"]}]
167167
}
168168
]

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
6060
steps:
6161
- name: Harden the runner (Audit all outbound calls)
62-
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
62+
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
6363
with:
6464
egress-policy: audit
6565

@@ -77,7 +77,7 @@ jobs:
7777

7878
# Initializes the CodeQL tools for scanning.
7979
- name: Initialize CodeQL
80-
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
80+
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
8181
with:
8282
languages: ${{ matrix.language }}
8383
build-mode: ${{ matrix.build-mode }}
@@ -105,6 +105,6 @@ jobs:
105105
exit 1
106106
107107
- name: Perform CodeQL Analysis
108-
uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
108+
uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
109109
with:
110110
category: "/language:${{matrix.language}}"

.github/workflows/doxygen-gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
contents: write
1717
steps:
1818
- name: Harden the runner (Audit all outbound calls)
19-
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
19+
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
2020
with:
2121
egress-policy: audit
2222

.github/workflows/ossf-scorecard-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: Harden the runner (Audit all outbound calls)
25-
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
25+
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
2626
with:
2727
egress-policy: audit
2828

@@ -56,6 +56,6 @@ jobs:
5656
# Upload the results to GitHub's code scanning dashboard (optional).
5757
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
5858
- name: "Upload to code-scanning"
59-
uses: github/codeql-action/upload-sarif@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
59+
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
6060
with:
6161
sarif_file: results.sarif
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
21
name: Lint Check (pre-commit)
32

43
on:
@@ -9,12 +8,8 @@ on:
98
branches:
109
- main
1110

12-
permissions:
13-
contents: read
14-
checks: write
15-
issues: write
16-
pull-requests: write
17-
1811
jobs:
1912
pre-commit:
13+
permissions:
14+
contents: read
2015
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-pre-commit.yml@1.7.2

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
- id: clang-format
2020
types_or: [c++, c]
2121

22-
# CMake linting and formatting
22+
# CMake linting and formatting
2323
- repo: https://github.com/BlankSpruce/gersemi-pre-commit
2424
rev: 0.27.2
2525
hooks:
@@ -43,10 +43,10 @@ repos:
4343
additional_dependencies:
4444
- tomli
4545

46-
# Beman Standard checking via beman-tidy
47-
- repo: https://github.com/bemanproject/beman-tidy
48-
rev: v0.3.1
49-
hooks:
50-
- id: beman-tidy
46+
# # Beman Standard checking via beman-tidy
47+
# - repo: https://github.com/bemanproject/beman-tidy
48+
# rev: v0.3.1
49+
# hooks:
50+
# - id: beman-tidy
5151

5252
exclude: 'template/|copier/|infra/|port/'

CMakePresets.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"_debug-base"
102102
],
103103
"cacheVariables": {
104+
"CMAKE_CXX_STANDARD": "23",
104105
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/msvc-toolchain.cmake"
105106
}
106107
},
@@ -112,6 +113,7 @@
112113
"_release-base"
113114
],
114115
"cacheVariables": {
116+
"CMAKE_CXX_STANDARD": "23",
115117
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/msvc-toolchain.cmake"
116118
}
117119
}

include/beman/expected/bad_expected_access.hpp

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33
#ifndef BEMAN_EXPECTED_BAD_EXPECTED_ACCESS_HPP
44
#define BEMAN_EXPECTED_BAD_EXPECTED_ACCESS_HPP
55

6-
#include <exception>
7-
#include <utility>
6+
#ifndef BEMAN_EXPECTED_INCLUDED_FROM_INTERFACE_UNIT
7+
#include <exception>
8+
#include <utility>
9+
#include <version>
10+
#endif
11+
12+
#ifdef __cpp_lib_constexpr_exceptions
13+
#define BEMAN_EXPECTED_CONSTEXPR_EXCEPTION constexpr
14+
#else
15+
#define BEMAN_EXPECTED_CONSTEXPR_EXCEPTION
16+
#endif
817

918
/***
1019
22.8.4 Class template bad_expected_access[expected.bad]
@@ -54,42 +63,44 @@ class bad_expected_access;
5463
template <>
5564
class bad_expected_access<void> : public std::exception {
5665
protected:
57-
constexpr bad_expected_access() noexcept = default;
58-
constexpr bad_expected_access(const bad_expected_access&) noexcept = default;
59-
constexpr bad_expected_access(bad_expected_access&&) noexcept = default;
60-
constexpr bad_expected_access& operator=(const bad_expected_access&) noexcept = default;
61-
constexpr bad_expected_access& operator=(bad_expected_access&&) noexcept = default;
62-
constexpr ~bad_expected_access() = default;
66+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION bad_expected_access() noexcept = default;
67+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION bad_expected_access(const bad_expected_access&) noexcept = default;
68+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION bad_expected_access(bad_expected_access&&) noexcept = default;
69+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION bad_expected_access& operator=(const bad_expected_access&) noexcept = default;
70+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION bad_expected_access& operator=(bad_expected_access&&) noexcept = default;
71+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION ~bad_expected_access() = default;
6372

6473
public:
65-
constexpr const char* what() const noexcept override;
74+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* what() const noexcept override;
6675
};
6776

6877
template <class E>
6978
class bad_expected_access : public bad_expected_access<void> {
7079
public:
71-
constexpr explicit bad_expected_access(E e);
72-
constexpr const char* what() const noexcept override;
73-
constexpr E& error() & noexcept;
74-
constexpr const E& error() const& noexcept;
75-
constexpr E&& error() && noexcept;
76-
constexpr const E&& error() const&& noexcept;
80+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION explicit bad_expected_access(E e);
81+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* what() const noexcept override;
82+
constexpr E& error() & noexcept;
83+
constexpr const E& error() const& noexcept;
84+
constexpr E&& error() && noexcept;
85+
constexpr const E&& error() const&& noexcept;
7786

7887
private:
7988
E unex;
8089
};
8190

8291
// bad_expected_access<void> out-of-line definitions
8392

84-
constexpr const char* bad_expected_access<void>::what() const noexcept { return "bad expected access"; }
93+
inline BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* bad_expected_access<void>::what() const noexcept {
94+
return "bad expected access";
95+
}
8596

8697
// bad_expected_access<E> out-of-line definitions
8798

8899
template <class E>
89-
constexpr bad_expected_access<E>::bad_expected_access(E e) : unex(std::move(e)) {}
100+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION bad_expected_access<E>::bad_expected_access(E e) : unex(std::move(e)) {}
90101

91102
template <class E>
92-
constexpr const char* bad_expected_access<E>::what() const noexcept {
103+
BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* bad_expected_access<E>::what() const noexcept {
93104
return "bad expected access";
94105
}
95106

@@ -116,4 +127,6 @@ constexpr const E&& bad_expected_access<E>::error() const&& noexcept {
116127
} // namespace expected
117128
} // namespace beman
118129

130+
#undef BEMAN_EXPECTED_CONSTEXPR_EXCEPTION
131+
119132
#endif

0 commit comments

Comments
 (0)