Skip to content

Commit 79935f9

Browse files
committed
Add explicit ctors for aggregation for types that default or delete ctors.
In C++20, types that declare or delete their default/copy/move constructors are no longer aggregates, so the aggregate uses of these types will not compile under C++20. Adding them fixes this, without affecting older language modes.
1 parent 0591975 commit 79935f9

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

include/swift/Driver/Compilation.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ class Compilation {
8989
/// This data is used for cross-module module dependencies.
9090
fine_grained_dependencies::ModuleDepGraph depGraph;
9191

92+
Result(bool hadAbnormalExit, int exitCode,
93+
fine_grained_dependencies::ModuleDepGraph depGraph)
94+
: hadAbnormalExit(hadAbnormalExit), exitCode(exitCode),
95+
depGraph(depGraph) {}
96+
9297
Result(const Result &) = delete;
9398
Result &operator=(const Result &) = delete;
9499

lib/AST/CASTBridging.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ struct BridgedDiagnosticImpl {
2020
InFlightDiagnostic inFlight;
2121
std::vector<StringRef> textBlobs;
2222

23+
BridgedDiagnosticImpl(InFlightDiagnostic inFlight,
24+
std::vector<StringRef> textBlobs)
25+
: inFlight(std::move(inFlight)), textBlobs(std::move(textBlobs)) {}
26+
2327
BridgedDiagnosticImpl(const BridgedDiagnosticImpl &) = delete;
2428
BridgedDiagnosticImpl(BridgedDiagnosticImpl &&) = delete;
2529
BridgedDiagnosticImpl &operator=(const BridgedDiagnosticImpl &) = delete;

lib/Frontend/DependencyVerifier.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ struct Obligation {
148148
public:
149149
Key() = delete;
150150

151+
private:
152+
Key(StringRef Name, Expectation::Kind Kind) : Name(Name), Kind(Kind) {}
153+
151154
public:
152155
static Key forNegative(StringRef name) {
153156
return Key{name, Expectation::Kind::Negative};

0 commit comments

Comments
 (0)