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

Missing MSVC-specific detection of some C++11 features #1023

Closed
baldurk opened this issue Sep 14, 2017 · 3 comments
Closed

Missing MSVC-specific detection of some C++11 features #1023

baldurk opened this issue Sep 14, 2017 · 3 comments

Comments

@baldurk
Copy link

baldurk commented Sep 14, 2017

Description

In catch_compiler_capabilities.h there are some special-case checks on _MSVC_VER to identify C++11/14/17 features to turn on feature macros, since __cplusplus is known to be unreliable on VS - see #697 and #479.

However there doesn't seem to be any detection of a couple of these - e.g. CATCH_CONFIG_CPP11_TUPLE, CATCH_CONFIG_CPP11_IS_ENUM, CATCH_CONFIG_CPP11_OVERRIDE, and CATCH_CONFIG_CPP11_LONG_LONG. This means the default stringifying doesn't work for tuples or enum classes, though it does if these macros are manually defined before including catch.

I believe these features should be available at the following versions:

Macro C++ Feature _MSC_VER VS Version
CATCH_CONFIG_CPP11_TUPLE std::tuple >= 1500 VS 2008*
CATCH_CONFIG_CPP11_IS_ENUM std::is_enum (type_traits) >= 1400 VS 2005
CATCH_CONFIG_CPP11_OVERRIDE override >= 1700 VS 2012
CATCH_CONFIG_CPP11_LONG_LONG long long >= 1600 VS 2010

Sourced from here and here.

*Possibly earlier, this was just the earliest docs version on MSDN.

Extra information

  • Catch version: v1.9.7 (Generated: 2017-08-10 23:49:15.233907)
  • Compiler+version: VS2015, although I believe the same will apply to VS2017 as __cplusplus is still defined to 199711L there.
@horenmar
Copy link
Member

horenmar commented Sep 14, 2017

If you open a PR and it passes CI, I am willing to merge it, but Catch Classic is no longer under development by us.

However, this should work by default in Catch 2 and we promise that final release will be out real soon now.

As a side note, __cplusplus will likely remain as 199711 under MSVC for quite a bit longer, as they do not want to change it until full C++11 (or higher) support can be provided and it still doesn't support two phase lookup.

@baldurk
Copy link
Author

baldurk commented Sep 14, 2017

Oh I'm sorry, I didn't think to check this on Catch 2. If it's fixed there then it's not important to me to PR a fix to a sunsetting branch, especially with potential side-effects of breaking it on some MSVC version that isn't tested in CI.

I'll close this and switch to 2 once it's released, I only noticed because I was trying to implement the local hack mentioned in #1024. Thank you!

RE: side note, in a twisted way that makes sense on their part, but pragmatically it's quite unhelpful :). Although I saw just recently that there's finally movement on that.

@baldurk baldurk closed this as completed Sep 14, 2017
@philsquared
Copy link
Collaborator

It's not so much "fixed" in Catch2 as no longer in scope, since Catch2 assumes C++11 (side-stepping two-phase look-up issues), so most of the compatibility detection goes away.
Of course that means you can't even use it on older versions of MSVC (I think we're only claiming support back to VS2015). But you've said you're on VS2016 so you should be fine.
While we won't be added new features to Catch Classic, it will still be maintained to an extent - so it's not out of the question to add something like this, although less of a priority for us.

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

No branches or pull requests

3 participants