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

reports the correct __cplusplus macro for MSVC IntelliSense Mode #6028

Closed
wants to merge 2 commits into from

Conversation

elahehrashedi
Copy link
Contributor

@elahehrashedi elahehrashedi commented Aug 25, 2020

feature-request: #2595
the language-server side is also altered to accommodate this feature.
The reason I am adding a default value for _Cplusplus is that if the IntelliSense mode is MSVC and the std version is c++17, the default value for _cplusplus is 201703L.

@sean-mcmanus
Copy link
Contributor

How does this work? I wouldn't think "/Zc" would be a valid define. It would think it would have be passed as a compilerArg, although then cpptools would have to be updated to process that.

@elahehrashedi elahehrashedi marked this pull request as draft August 25, 2020 21:18
@elahehrashedi elahehrashedi reopened this Aug 25, 2020
@bobbrow
Copy link
Member

bobbrow commented Aug 25, 2020

Does cl.exe set this by default in newer versions? You have to opt in. I didn't expect to see any change to the TypeScript for this issue.

EDIT: From: https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
You need to compile with the /Zc:__cplusplus switch to see the updated value of the __cplusplus macro. We tried updating the macro by default and discovered that a lot of code doesn’t compile correctly when we change the value of __cplusplus. We’ll continue to require use of the /Zc:__cplusplus switch for all minor versions of MSVC in the 19.xx family.

@sean-mcmanus
Copy link
Contributor

Does cl.exe set this by default in newer versions? You have to opt in. I didn't expect to see any change to the TypeScript for this issue.

EDIT: From: https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
You need to compile with the /Zc:__cplusplus switch to see the updated value of the __cplusplus macro. We tried updating the macro by default and discovered that a lot of code doesn’t compile correctly when we change the value of __cplusplus. We’ll continue to require use of the /Zc:__cplusplus switch for all minor versions of MSVC in the 19.xx family.

That seems to imply we shouldn't change the defaults?

@bobbrow
Copy link
Member

bobbrow commented Aug 26, 2020

We shouldn't change the defaults for now. When the compiler updates the version to 20.xx we may have to make some changes, but we're still on 19.xx now.

@elahehrashedi elahehrashedi deleted the elrashed/2595 branch September 2, 2020 18:06
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants