jeremy-rifkin / libassert

The most over-engineered C++ assertion library
MIT License
539 stars 36 forks source link

`libassert_msvc_pfunc` is not defined when using Clang on Windows #104

Closed MoshiKoi closed 1 month ago

MoshiKoi commented 1 month ago

For compatibility reasons, the Windows version of Clang defines _MSC_VER, meaning libassert detects the compiler as MSVC

https://github.com/jeremy-rifkin/libassert/blob/b90077a6a9e2ea178c50f5df5729873dfc3fd5fb/include/libassert/platform.hpp#L52-L58

This causes some issues. For example, ASSERT_VAL eventually calls the LIBASSERT_INVOKE_VAL_PRETTY_FUNCTION_ARG macro which in this scenario relies on a built-in that Clang doesn't support:

https://github.com/jeremy-rifkin/libassert/blob/b90077a6a9e2ea178c50f5df5729873dfc3fd5fb/include/libassert/assert.hpp#L687-L689

I think this can be fixed by just replacing the #ifdef _MSC_VER with #if defined(_MSC_VER) && !defined(__clang__). It fixes the ASSERT_VAL issue, but I'm not sure what else might change (though it should be fine since presumably it'll just switch to the clang version of libassert everywhere else as well).

jeremy-rifkin commented 1 month ago

Thanks for opening this, should be a quick fix! I can take more of a look at this tomorrow or Friday. Might be an unintended consequence of #93.

jeremy-rifkin commented 1 month ago

Fixed in e55076cd03255d389c866212ecd3d937bb41946e

jeremy-rifkin commented 1 month ago

2.1.2 is released with a fix for this