Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC C++ 20 With Diagnostic Services #109

Open
ajorians opened this issue Oct 12, 2023 · 1 comment
Open

MSVC C++ 20 With Diagnostic Services #109

ajorians opened this issue Oct 12, 2023 · 1 comment

Comments

@ajorians
Copy link

The following information is odd anyway and as you'll see is easy to resolve on our side. Meaning I wasn't thinking any actions need to be done at all; but figured at least let you know about it.

First consider Microsoft has the ability to detect memory leaks with some Diagnostic Services via redefining the new operator:
image

With C++17 this isn't a problem as you can see with this online link: https://godbolt.org/z/nx35hhY9r

(note: Compiler Explorer doesn't install with MFC/ATL but those defines should give similar effect).

It builds. But if you change the setting to build as C++20 (or later) it fails to compile; here is an online link: https://godbolt.org/z/M3ba6r48h
image

I, myself, am using boost 1.81.0 where I am noticing this issue.

Hope that helps!

@pdimov
Copy link
Member

pdimov commented Oct 12, 2023

The reason for the difference is that MSVC is using the old compiler frontend (/permissive) in C++17 mode and the new one in C++20 mode (/permissive-).

In "permissive" mode, syntax errors in templates that aren't used (such as the above shared_count constructor that takes an allocator) do not cause compilation to fail, but in "permissive-" mode, they do.

Since the code is already passing arguments to new, the macro that passes file/line causes a syntax error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants