We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c90bb21 commit 5202145Copy full SHA for 5202145
test/iso_fortran_binding/sampling.cpp
@@ -9,7 +9,10 @@
9
#include <algorithm>
10
#include <vector>
11
#include <string>
12
+
13
+#if __has_include(<source_location>)
14
#include <source_location>
15
+#endif
16
17
#include <ISO_Fortran_binding.h>
18
@@ -54,8 +57,13 @@ std::string cfiGetErrorString(int stat) {
54
57
void check_cfi(int s)
55
58
{
56
59
if (s != CFI_SUCCESS){
60
+#if defined(__cpp_lib_source_location)
61
constexpr std::source_location loc = std::source_location::current();
- std::cerr << loc.file_name() << ":" << loc.line() << " CFI API failed with error: (" << s << ") " << cfiGetErrorString(s) << "\n";
62
+ std::cerr << loc.file_name() << ":" << loc.line() <<
63
+#else
64
+ std::cerr <<
65
66
+ " CFI API failed with error: (" << s << ") " << cfiGetErrorString(s) << "\n";
67
}
68
69
0 commit comments