Skip to content

Commit 681b0e1

Browse files
authored
Merge pull request #310 from wravery/main
fix: schema input type member default init error on clang 14
2 parents f5b412a + 4542107 commit 681b0e1

File tree

9 files changed

+136
-63
lines changed

9 files changed

+136
-63
lines changed

samples/learn/schema/StarWarsSchema.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ learn::ReviewInput Argument<learn::ReviewInput>::convert(const response::Value&
9797
namespace learn {
9898

9999
ReviewInput::ReviewInput() noexcept
100+
: stars {}
101+
, commentary {}
100102
{
101103
// Explicit definition to prevent ODR violations when LTO is enabled.
102104
}

samples/learn/schema/StarWarsSchema.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ struct [[nodiscard("unnecessary construction")]] ReviewInput
6464
ReviewInput& operator=(const ReviewInput& other);
6565
ReviewInput& operator=(ReviewInput&& other) noexcept;
6666

67-
int stars {};
68-
std::optional<std::string> commentary {};
67+
int stars;
68+
std::optional<std::string> commentary;
6969
};
7070

7171
namespace object {

samples/today/nointrospection/TodaySchema.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ today::FirstNestedInput Argument<today::FirstNestedInput>::convert(const respons
228228
namespace today {
229229

230230
CompleteTaskInput::CompleteTaskInput() noexcept
231+
: id {}
232+
, testTaskState {}
233+
, isComplete {}
234+
, clientMutationId {}
231235
{
232236
// Explicit definition to prevent ODR violations when LTO is enabled.
233237
}
@@ -285,6 +289,8 @@ CompleteTaskInput& CompleteTaskInput::operator=(CompleteTaskInput&& other) noexc
285289
}
286290

287291
ThirdNestedInput::ThirdNestedInput() noexcept
292+
: id {}
293+
, second {}
288294
{
289295
// Explicit definition to prevent ODR violations when LTO is enabled.
290296
}
@@ -332,6 +338,7 @@ ThirdNestedInput& ThirdNestedInput::operator=(ThirdNestedInput&& other) noexcept
332338
}
333339

334340
FourthNestedInput::FourthNestedInput() noexcept
341+
: id {}
335342
{
336343
// Explicit definition to prevent ODR violations when LTO is enabled.
337344
}
@@ -374,6 +381,7 @@ FourthNestedInput& FourthNestedInput::operator=(FourthNestedInput&& other) noexc
374381
}
375382

376383
IncludeNullableSelfInput::IncludeNullableSelfInput() noexcept
384+
: self {}
377385
{
378386
// Explicit definition to prevent ODR violations when LTO is enabled.
379387
}
@@ -416,6 +424,7 @@ IncludeNullableSelfInput& IncludeNullableSelfInput::operator=(IncludeNullableSel
416424
}
417425

418426
IncludeNonNullableListSelfInput::IncludeNonNullableListSelfInput() noexcept
427+
: selves {}
419428
{
420429
// Explicit definition to prevent ODR violations when LTO is enabled.
421430
}
@@ -458,6 +467,18 @@ IncludeNonNullableListSelfInput& IncludeNonNullableListSelfInput::operator=(Incl
458467
}
459468

460469
StringOperationFilterInput::StringOperationFilterInput() noexcept
470+
: and_ {}
471+
, or_ {}
472+
, equal {}
473+
, notEqual {}
474+
, contains {}
475+
, notContains {}
476+
, in {}
477+
, notIn {}
478+
, startsWith {}
479+
, notStartsWith {}
480+
, endsWith {}
481+
, notEndsWith {}
461482
{
462483
// Explicit definition to prevent ODR violations when LTO is enabled.
463484
}
@@ -555,6 +576,8 @@ StringOperationFilterInput& StringOperationFilterInput::operator=(StringOperatio
555576
}
556577

557578
SecondNestedInput::SecondNestedInput() noexcept
579+
: id {}
580+
, third {}
558581
{
559582
// Explicit definition to prevent ODR violations when LTO is enabled.
560583
}
@@ -602,6 +625,8 @@ SecondNestedInput& SecondNestedInput::operator=(SecondNestedInput&& other) noexc
602625
}
603626

604627
ForwardDeclaredInput::ForwardDeclaredInput() noexcept
628+
: nullableSelf {}
629+
, listSelves {}
605630
{
606631
// Explicit definition to prevent ODR violations when LTO is enabled.
607632
}
@@ -649,6 +674,9 @@ ForwardDeclaredInput& ForwardDeclaredInput::operator=(ForwardDeclaredInput&& oth
649674
}
650675

651676
FirstNestedInput::FirstNestedInput() noexcept
677+
: id {}
678+
, second {}
679+
, third {}
652680
{
653681
// Explicit definition to prevent ODR violations when LTO is enabled.
654682
}

samples/today/nointrospection/TodaySchema.h

+28-28
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ struct [[nodiscard("unnecessary construction")]] CompleteTaskInput
6969
CompleteTaskInput& operator=(const CompleteTaskInput& other);
7070
CompleteTaskInput& operator=(CompleteTaskInput&& other) noexcept;
7171

72-
response::IdType id {};
73-
std::optional<TaskState> testTaskState {};
74-
std::optional<bool> isComplete {};
75-
std::optional<std::string> clientMutationId {};
72+
response::IdType id;
73+
std::optional<TaskState> testTaskState;
74+
std::optional<bool> isComplete;
75+
std::optional<std::string> clientMutationId;
7676
};
7777

7878
struct SecondNestedInput;
@@ -90,8 +90,8 @@ struct [[nodiscard("unnecessary construction")]] ThirdNestedInput
9090
ThirdNestedInput& operator=(const ThirdNestedInput& other);
9191
ThirdNestedInput& operator=(ThirdNestedInput&& other) noexcept;
9292

93-
response::IdType id {};
94-
std::unique_ptr<SecondNestedInput> second {};
93+
response::IdType id;
94+
std::unique_ptr<SecondNestedInput> second;
9595
};
9696

9797
struct [[nodiscard("unnecessary construction")]] FourthNestedInput
@@ -106,7 +106,7 @@ struct [[nodiscard("unnecessary construction")]] FourthNestedInput
106106
FourthNestedInput& operator=(const FourthNestedInput& other);
107107
FourthNestedInput& operator=(FourthNestedInput&& other) noexcept;
108108

109-
response::IdType id {};
109+
response::IdType id;
110110
};
111111

112112
struct [[nodiscard("unnecessary construction")]] IncludeNullableSelfInput
@@ -121,7 +121,7 @@ struct [[nodiscard("unnecessary construction")]] IncludeNullableSelfInput
121121
IncludeNullableSelfInput& operator=(const IncludeNullableSelfInput& other);
122122
IncludeNullableSelfInput& operator=(IncludeNullableSelfInput&& other) noexcept;
123123

124-
std::unique_ptr<IncludeNullableSelfInput> self {};
124+
std::unique_ptr<IncludeNullableSelfInput> self;
125125
};
126126

127127
struct [[nodiscard("unnecessary construction")]] IncludeNonNullableListSelfInput
@@ -136,7 +136,7 @@ struct [[nodiscard("unnecessary construction")]] IncludeNonNullableListSelfInput
136136
IncludeNonNullableListSelfInput& operator=(const IncludeNonNullableListSelfInput& other);
137137
IncludeNonNullableListSelfInput& operator=(IncludeNonNullableListSelfInput&& other) noexcept;
138138

139-
std::vector<IncludeNonNullableListSelfInput> selves {};
139+
std::vector<IncludeNonNullableListSelfInput> selves;
140140
};
141141

142142
struct [[nodiscard("unnecessary construction")]] StringOperationFilterInput
@@ -162,18 +162,18 @@ struct [[nodiscard("unnecessary construction")]] StringOperationFilterInput
162162
StringOperationFilterInput& operator=(const StringOperationFilterInput& other);
163163
StringOperationFilterInput& operator=(StringOperationFilterInput&& other) noexcept;
164164

165-
std::optional<std::vector<StringOperationFilterInput>> and_ {};
166-
std::optional<std::vector<StringOperationFilterInput>> or_ {};
167-
std::optional<std::string> equal {};
168-
std::optional<std::string> notEqual {};
169-
std::optional<std::string> contains {};
170-
std::optional<std::string> notContains {};
171-
std::optional<std::vector<std::string>> in {};
172-
std::optional<std::vector<std::string>> notIn {};
173-
std::optional<std::string> startsWith {};
174-
std::optional<std::string> notStartsWith {};
175-
std::optional<std::string> endsWith {};
176-
std::optional<std::string> notEndsWith {};
165+
std::optional<std::vector<StringOperationFilterInput>> and_;
166+
std::optional<std::vector<StringOperationFilterInput>> or_;
167+
std::optional<std::string> equal;
168+
std::optional<std::string> notEqual;
169+
std::optional<std::string> contains;
170+
std::optional<std::string> notContains;
171+
std::optional<std::vector<std::string>> in;
172+
std::optional<std::vector<std::string>> notIn;
173+
std::optional<std::string> startsWith;
174+
std::optional<std::string> notStartsWith;
175+
std::optional<std::string> endsWith;
176+
std::optional<std::string> notEndsWith;
177177
};
178178

179179
struct [[nodiscard("unnecessary construction")]] SecondNestedInput
@@ -189,8 +189,8 @@ struct [[nodiscard("unnecessary construction")]] SecondNestedInput
189189
SecondNestedInput& operator=(const SecondNestedInput& other);
190190
SecondNestedInput& operator=(SecondNestedInput&& other) noexcept;
191191

192-
response::IdType id {};
193-
ThirdNestedInput third {};
192+
response::IdType id;
193+
ThirdNestedInput third;
194194
};
195195

196196
struct [[nodiscard("unnecessary construction")]] ForwardDeclaredInput
@@ -206,8 +206,8 @@ struct [[nodiscard("unnecessary construction")]] ForwardDeclaredInput
206206
ForwardDeclaredInput& operator=(const ForwardDeclaredInput& other);
207207
ForwardDeclaredInput& operator=(ForwardDeclaredInput&& other) noexcept;
208208

209-
std::unique_ptr<IncludeNullableSelfInput> nullableSelf {};
210-
IncludeNonNullableListSelfInput listSelves {};
209+
std::unique_ptr<IncludeNullableSelfInput> nullableSelf;
210+
IncludeNonNullableListSelfInput listSelves;
211211
};
212212

213213
struct [[nodiscard("unnecessary construction")]] FirstNestedInput
@@ -224,9 +224,9 @@ struct [[nodiscard("unnecessary construction")]] FirstNestedInput
224224
FirstNestedInput& operator=(const FirstNestedInput& other);
225225
FirstNestedInput& operator=(FirstNestedInput&& other) noexcept;
226226

227-
response::IdType id {};
228-
SecondNestedInput second {};
229-
ThirdNestedInput third {};
227+
response::IdType id;
228+
SecondNestedInput second;
229+
ThirdNestedInput third;
230230
};
231231

232232
namespace object {

samples/today/schema/TodaySchema.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ today::FirstNestedInput Argument<today::FirstNestedInput>::convert(const respons
228228
namespace today {
229229

230230
CompleteTaskInput::CompleteTaskInput() noexcept
231+
: id {}
232+
, testTaskState {}
233+
, isComplete {}
234+
, clientMutationId {}
231235
{
232236
// Explicit definition to prevent ODR violations when LTO is enabled.
233237
}
@@ -285,6 +289,8 @@ CompleteTaskInput& CompleteTaskInput::operator=(CompleteTaskInput&& other) noexc
285289
}
286290

287291
ThirdNestedInput::ThirdNestedInput() noexcept
292+
: id {}
293+
, second {}
288294
{
289295
// Explicit definition to prevent ODR violations when LTO is enabled.
290296
}
@@ -332,6 +338,7 @@ ThirdNestedInput& ThirdNestedInput::operator=(ThirdNestedInput&& other) noexcept
332338
}
333339

334340
FourthNestedInput::FourthNestedInput() noexcept
341+
: id {}
335342
{
336343
// Explicit definition to prevent ODR violations when LTO is enabled.
337344
}
@@ -374,6 +381,7 @@ FourthNestedInput& FourthNestedInput::operator=(FourthNestedInput&& other) noexc
374381
}
375382

376383
IncludeNullableSelfInput::IncludeNullableSelfInput() noexcept
384+
: self {}
377385
{
378386
// Explicit definition to prevent ODR violations when LTO is enabled.
379387
}
@@ -416,6 +424,7 @@ IncludeNullableSelfInput& IncludeNullableSelfInput::operator=(IncludeNullableSel
416424
}
417425

418426
IncludeNonNullableListSelfInput::IncludeNonNullableListSelfInput() noexcept
427+
: selves {}
419428
{
420429
// Explicit definition to prevent ODR violations when LTO is enabled.
421430
}
@@ -458,6 +467,18 @@ IncludeNonNullableListSelfInput& IncludeNonNullableListSelfInput::operator=(Incl
458467
}
459468

460469
StringOperationFilterInput::StringOperationFilterInput() noexcept
470+
: and_ {}
471+
, or_ {}
472+
, equal {}
473+
, notEqual {}
474+
, contains {}
475+
, notContains {}
476+
, in {}
477+
, notIn {}
478+
, startsWith {}
479+
, notStartsWith {}
480+
, endsWith {}
481+
, notEndsWith {}
461482
{
462483
// Explicit definition to prevent ODR violations when LTO is enabled.
463484
}
@@ -555,6 +576,8 @@ StringOperationFilterInput& StringOperationFilterInput::operator=(StringOperatio
555576
}
556577

557578
SecondNestedInput::SecondNestedInput() noexcept
579+
: id {}
580+
, third {}
558581
{
559582
// Explicit definition to prevent ODR violations when LTO is enabled.
560583
}
@@ -602,6 +625,8 @@ SecondNestedInput& SecondNestedInput::operator=(SecondNestedInput&& other) noexc
602625
}
603626

604627
ForwardDeclaredInput::ForwardDeclaredInput() noexcept
628+
: nullableSelf {}
629+
, listSelves {}
605630
{
606631
// Explicit definition to prevent ODR violations when LTO is enabled.
607632
}
@@ -649,6 +674,9 @@ ForwardDeclaredInput& ForwardDeclaredInput::operator=(ForwardDeclaredInput&& oth
649674
}
650675

651676
FirstNestedInput::FirstNestedInput() noexcept
677+
: id {}
678+
, second {}
679+
, third {}
652680
{
653681
// Explicit definition to prevent ODR violations when LTO is enabled.
654682
}

0 commit comments

Comments
 (0)