Skip to content

Commit 6e2568d

Browse files
committed
Fix compile on libstdc++/libc++
1 parent 0c46d6c commit 6e2568d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

projects/core/include/tempest/source_location.hpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
#include <tempest/int.hpp>
55

6-
// Check for GLIBCXX or LIBCPP
7-
#if ((defined(__GLIBCXX__) && !defined(_GLIBCXX_SRCLOC)) || \
8-
(defined(_LIBCPP_VERSION) && !defined(_LIBCPP_SOURCE_LOCATION))) && \
9-
(defined(__GNUC__) || defined(__clang__))
6+
// If (GNUC or CLANG) and not (_GLIBCXX_SRCLOC or _LIBCPP_SOURCE_LOCATION) OR SELF_HOSTED
7+
#if (defined(__GNUC__) || defined(__clang__)) && !defined(_GLIBCXX_SRCLOC) && !defined(_LIBCPP_SOURCE_LOCATION) || \
8+
defined(__STDC_HOSTED__)
109

1110
// Known UB. If libstdc++ or libc++ changes the layout of std::source_location::__impl, this will break
1211
// TODO: Investigate a robust way to test for this. Maybe C++26 static reflection will provide a solution.
@@ -37,12 +36,12 @@ namespace std
3736
return _impl->_M_function_name;
3837
}
3938

40-
constexpr size_t line() const noexcept
39+
constexpr unsigned line() const noexcept
4140
{
4241
return _impl->_M_line;
4342
}
4443

45-
constexpr size_t column() const noexcept
44+
constexpr unsigned column() const noexcept
4645
{
4746
return _impl->_M_column;
4847
}

0 commit comments

Comments
 (0)