Skip to content

Commit 530d383

Browse files
authored
Partial GCC compatibility improvements (#1234)
1 parent 37bd17f commit 530d383

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

cppwinrt/pch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include <utility>
34
#include "cmd_reader.h"
45
#include <winmd_reader.h>
56
#include "task_group.h"

cppwinrt/text_writer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <sstream>
77
#include <string>
88
#include <string_view>
9+
#include <vector>
910

1011
namespace cppwinrt
1112
{

strings/base_chrono.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ WINRT_EXPORT namespace winrt
4747

4848
static time_point from_time_t(time_t time) noexcept
4949
{
50-
return from_sys(std::chrono::system_clock::from_time_t(time));
50+
return std::chrono::time_point_cast<duration>(from_sys(std::chrono::system_clock::from_time_t(time)));
5151
}
5252

5353
static file_time to_file_time(time_point const& time) noexcept

strings/base_includes.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <charconv>
77
#include <chrono>
88
#include <cstddef>
9+
#include <cstring>
910
#include <iterator>
1011
#include <map>
1112
#include <memory>
@@ -20,6 +21,10 @@
2021
#include <utility>
2122
#include <vector>
2223

24+
#if __has_include(<version>)
25+
#include <version>
26+
#endif
27+
2328
#if __has_include(<windowsnumerics.impl.h>)
2429
#define WINRT_IMPL_NUMERICS
2530
#include <directxmath.h>
@@ -50,7 +55,7 @@ namespace winrt::impl
5055
using suspend_never = std::suspend_never;
5156
}
5257

53-
#else
58+
#elif __has_include(<experimental/coroutine>)
5459

5560
#include <experimental/coroutine>
5661

@@ -63,4 +68,6 @@ namespace winrt::impl
6368
using suspend_never = std::experimental::suspend_never;
6469
}
6570

71+
#else
72+
#error C++/WinRT requires coroutine support, which is currently missing. Try enabling C++20 in your compiler.
6673
#endif

strings/base_string_operators.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ WINRT_EXPORT namespace winrt
5555
return left < std::wstring_view(right);
5656
}
5757

58-
bool operator<(hstring const& left, nullptr_t) = delete;
58+
bool operator<(hstring const& left, std::nullptr_t) = delete;
5959

60-
bool operator<(nullptr_t, hstring const& right) = delete;
60+
bool operator<(std::nullptr_t, hstring const& right) = delete;
6161
inline bool operator!=(hstring const& left, hstring const& right) noexcept { return !(left == right); }
6262
inline bool operator>(hstring const& left, hstring const& right) noexcept { return right < left; }
6363
inline bool operator<=(hstring const& left, hstring const& right) noexcept { return !(right < left); }

0 commit comments

Comments
 (0)