Skip to content

Commit 1bf4e78

Browse files
committed
std::uncaught_exception -> std::uncaught_exceptions
`std::uncaught_exception` has been deprecated in C++17, so it generates a warning (which we treat as an error). Replaced it with `std::uncaught_exceptions`, which returns the number of uncaught exceptions (but can still be used as a boolean in the test).
1 parent 43c8ce4 commit 1bf4e78

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/test_core.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,18 +1287,18 @@ def test_exceptions_uncaught(self):
12871287
#include <exception>
12881288
struct X {
12891289
~X() {
1290-
printf("exception? %s\n", std::uncaught_exception() ? "yes" : "no");
1290+
printf("exception? %s\n", std::uncaught_exceptions() ? "yes" : "no");
12911291
}
12921292
};
12931293
int main() {
1294-
printf("exception? %s\n", std::uncaught_exception() ? "yes" : "no");
1294+
printf("exception? %s\n", std::uncaught_exceptions() ? "yes" : "no");
12951295
try {
12961296
X x;
12971297
throw 1;
12981298
} catch(...) {
1299-
printf("exception? %s\n", std::uncaught_exception() ? "yes" : "no");
1299+
printf("exception? %s\n", std::uncaught_exceptions() ? "yes" : "no");
13001300
}
1301-
printf("exception? %s\n", std::uncaught_exception() ? "yes" : "no");
1301+
printf("exception? %s\n", std::uncaught_exceptions() ? "yes" : "no");
13021302
return 0;
13031303
}
13041304
'''
@@ -1309,7 +1309,7 @@ def test_exceptions_uncaught(self):
13091309
#include <iostream>
13101310
int main() {
13111311
std::ofstream os("test");
1312-
os << std::unitbuf << "foo"; // trigger a call to std::uncaught_exception from
1312+
os << std::unitbuf << "foo"; // trigger a call to std::uncaught_exceptions from
13131313
// std::basic_ostream::sentry::~sentry
13141314
std::cout << "success\n";
13151315
}
@@ -1331,8 +1331,8 @@ def test_exceptions_uncaught_2(self):
13311331
} catch(std::exception) {}
13321332
}
13331333
1334-
if (std::uncaught_exception())
1335-
std::cout << "ERROR: uncaught_exception still set.\n";
1334+
if (std::uncaught_exceptions())
1335+
std::cout << "ERROR: uncaught_exceptions still set.\n";
13361336
else
13371337
std::cout << "OK\n";
13381338
}

0 commit comments

Comments
 (0)