This repository was archived by the owner on Feb 14, 2025. It is now read-only.
Commit 874dfc0
Cast ::GetLastError to int (flutter#57113)
`GetLastError` returns an unsigned 32 bit integer that was being
implicitly cast to an int for the std::variant<..., int>. This was
causing my build to fail with:
```
../../flutter/shell/platform/windows/platform_handler.cc(178,12): error: no viable conversion from returned value of type 'DWORD' (aka 'unsigned long') to function return type 'std::variant<std::wstring, int>' (aka 'variant<basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>, int>')
178 | return ::GetLastError();
| ^~~~~~~~~~~~~~~~
../../../../../../../Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.42.34433/include\variant(923,7): note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'DWORD' (aka 'unsigned long') to 'const variant<basic_string<wchar_t>, int> &' for 1st argument
923 | class variant : private _SMF_control<_Variant_destroy_layer<_Types...>, _Types...> { // discriminated union
| ^~~~~~~
```
Commands:
```
./flutter/tools/gn --runtime-mode release --no-rbe
ninja -C .\out\host_release windows gen_snapshot flutter/build/archives:windows_flutter
```
Explicitly casting `::GetLastError` to an int fixes this issue.
I'm running on Windows 11 (Version 10.0.26100 Build 26100) with VS 2022
Community Edition.
@loic-sharma
Co-authored-by: Eric Seidel <eric@shorebird.dev>1 parent 21c13fa commit 874dfc0
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
0 commit comments