aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/patches/69-no-builtin_source_location_clang14.patch
blob: 8327e658b60c84c645232ac5adcec679a480e8d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/include/source_location b/include/source_location
index d16e3c4..958c16f 100644
--- a/include/source_location
+++ b/include/source_location
@@ -52,12 +52,23 @@ class source_location {
   // in constant evaluation, so we don't want to use `void*` as the argument
   // type unless the builtin returned that, anyhow, and the invalid cast is
   // unavoidable.
+#  if __has_builtin(__builtin_source_location)
   using __bsl_ty = decltype(__builtin_source_location());
+#  else
+  using __bsl_ty = __impl*;
+#  endif
 
 public:
   // The defaulted __ptr argument is necessary so that the builtin is evaluated
   // in the context of the caller. An explicit value should never be provided.
-  static consteval source_location current(__bsl_ty __ptr = __builtin_source_location()) noexcept {
+  static consteval source_location
+  current(__bsl_ty __ptr =
+#  if __has_builtin(__builtin_source_location)
+              __builtin_source_location()
+#  else
+              nullptr
+#  endif
+              ) noexcept {
     source_location __sl;
     __sl.__ptr_ = static_cast<const __impl*>(__ptr);
     return __sl;