mohabouje / WinToast

WinToast is a lightly library written in C++ which brings a complete integration of the modern toast notifications of Windows 8 & Windows 10. Toast notifications allows your app to inform the users about relevant information and timely events that they should see and take action upon inside your app, such as a new instant message, a new friend request, breaking news, or a calendar event.
MIT License
688 stars 127 forks source link

'auto' must always deduce to the same type #40

Closed dedmen closed 5 years ago

dedmen commented 5 years ago
wintoastlib.cpp(665): error C3538: in a declarator-list 'auto' must always deduce to the same type
  wintoastlib.cpp(665): note: could be 'unsigned int'
  wintoastlib.cpp(665): note: or       'size_t'

Visual Studio 2019 with C++17.

https://github.com/mohabouje/WinToast/blob/master/src/wintoastlib.cpp#L650

auto deduces to unsigned int, and textFieldsCount returns size_t which is unsigned __int64 on 64bit. I fixed it by replacing 0u with 0ull but that only works because I build x64 only. On 32bit that would missmatch again.

mohabouje commented 5 years ago

Good catch! I should add a note in the documentation to enforce the usage of releases or tagged version.

The current master branch has been modified recently and has not been tested yet in all the different platform.

In this case, probably the easiest solution is to avoid auto and replace it by a simple unsigned type, maybe unsigned long or unsigned int.

mohabouje commented 5 years ago

The problem has been fixed in this commit. I compiled the code with the latest MVSC in x86 and x64 platforms in Windows 8 and Windows 10.

Could you confirm that the latest state compiles properly @dedmen ?

dedmen commented 5 years ago

Confirmed, all good now. Didn't notice any problems on master branch. Win 8.1 and Win10 x64.