jeremy-rifkin / libassert

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

Resharper and Assertion with message #106

Closed DNKpp closed 2 weeks ago

DNKpp commented 2 weeks ago

Hey, I recently started using your library. As I often write template code, I didn't notify that issue immediately. But after a while, when I switched writing an actual class, I always saw red underlining, when using any assert like macro with a message param. Without a message I do not see any errors. E.g. image

The code compiles fine, but resharper shows a very weird preview of the macro: image

I'm by no means a macro expert and have no idea what could cause that issue. Perhaps you have an idea how help resharper out a bit? I'm working on Windows 11 with Visual Studio 2022 (latest) and the latest resharper installed.

Greetings Dominic

DNKpp commented 2 weeks ago

Well, I actually found the solution by accident. I added another dependency, which does the following: image

This seems to please resharper, even if it doesn't change anything in regards of compilation proceedure. The macro in question now get's successfully expandend: image

jeremy-rifkin commented 2 weeks ago

Hello! Glad you found a solution, I would have been at a loss. Microsoft's legacy preprocessor is not compliant with the language standard. Libassert checks for this and uses a different set of macros in that case, but it looks like resharper internally expects a normal preprocessor.