Skip to content

Commit ed29e16

Browse files
committed
catch exception by reference so that compiler does not complain
1 parent c4515b0 commit ed29e16

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/util/parse-options-test.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void UnitTestParseOptions() {
120120
po4.Register("option", &val, "My boolean");
121121
po4.Read(argc4, argv4);
122122
assert(false); // Should not reach this part of code.
123-
} catch(std::exception e) {
123+
} catch(std::exception &e) {
124124
KALDI_LOG << "Failed to read option (this is expected).";
125125
}
126126

@@ -144,7 +144,7 @@ void UnitTestParseOptions() {
144144
po4.Register("option", &val, "My string");
145145
po4.Read(argc4, argv4);
146146
assert(false); // Should not reach this part of code.
147-
} catch(std::exception e) {
147+
} catch(std::exception &e) {
148148
KALDI_LOG << "Failed to read option (this is expected).";
149149
}
150150

@@ -186,7 +186,7 @@ void UnitTestParseOptions() {
186186
po4.Read(argc4, argv4);
187187
KALDI_ASSERT(val == "bar");
188188
}
189-
189+
190190
try { // test error with --float=string
191191
int argc4 = 2;
192192
const char *argv4[2] = { "program_name", "--option=foo"};
@@ -195,7 +195,7 @@ void UnitTestParseOptions() {
195195
po4.Register("option", &val, "My float");
196196
po4.Read(argc4, argv4);
197197
assert(false); // Should not reach this part of code.
198-
} catch(std::exception e) {
198+
} catch(std::exception &e) {
199199
KALDI_LOG << "Failed to read option (this is expected).";
200200
}
201201

@@ -208,7 +208,7 @@ void UnitTestParseOptions() {
208208
po4.Register("option", &val, "My int");
209209
po4.Read(argc4, argv4);
210210
assert(false); // Should not reach this part of code.
211-
} catch(std::exception e) {
211+
} catch(std::exception &e) {
212212
KALDI_LOG << "Failed to read option (this is expected).";
213213
}
214214

@@ -220,7 +220,7 @@ void UnitTestParseOptions() {
220220
po4.Register("option", &val, "My int");
221221
po4.Read(argc4, argv4);
222222
assert(false); // Should not reach this part of code.
223-
} catch(std::exception e) {
223+
} catch(std::exception &e) {
224224
KALDI_LOG << "Failed to read option (this is expected).";
225225
}
226226

@@ -232,7 +232,7 @@ void UnitTestParseOptions() {
232232
po4.Register("option", &val, "My int");
233233
po4.Read(argc4, argv4);
234234
assert(false); // Should not reach this part of code.
235-
} catch(std::exception e) {
235+
} catch(std::exception &e) {
236236
KALDI_LOG << "Failed to read option (this is expected)xxx.";
237237
}
238238

@@ -244,7 +244,7 @@ void UnitTestParseOptions() {
244244
po4.Register("option", &val, "My bool");
245245
po4.Read(argc4, argv4);
246246
assert(false); // Should not reach this part of code.
247-
} catch(std::exception e) {
247+
} catch(std::exception &e) {
248248
KALDI_LOG << "Failed to read option (this is expected).";
249249
}
250250

@@ -258,7 +258,7 @@ void UnitTestParseOptions() {
258258
po4.Register("num", &num, "My int32 variable");
259259
po4.Read(argc4, argv4);
260260
KALDI_ASSERT(num == 0);
261-
} catch(std::exception e) {
261+
} catch(std::exception &e) {
262262
KALDI_LOG << "Failed to read option (this is expected).";
263263
}
264264

0 commit comments

Comments
 (0)