foonathan / memory

STL compatible C++ memory allocator library using a new RawAllocator concept that is similar to an Allocator but easier to use and write.
https://memory.foonathan.net
zlib License
1.5k stars 195 forks source link

WIP: Bugfix: fix issue 145 compile on VS 2022 #146

Closed burnpanck closed 1 year ago

burnpanck commented 1 year ago

This PR provides a workaround around a compiler bug, which seems to have appeared in VS 2022. It appears that the bug is only triggered with /permissive-, which is enabled by default when using /std:c++20. As I was unable to make CMAKE set the former, I simply set the latter in the accompanying CI tests.

In this version of the PR, the workaround is hidden behind a FOONATHAN_SFINAE_WORKAROUND guard, which for now is implemented unconditionally, as I haven't fully determined what versions and compiler flag combinations really trigger the issue. Since you have used std::declval in other places within FOONATHAN_SFINAE, maybe the workaround could actually be used unconditionally everywhere, and the guard removed? Let me know.

foonathan commented 1 year ago

Ignore the MacOS failures; I'll fix.

foonathan commented 1 year ago

Thank you.