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

c++17 requirement for testing private members #188

Closed
YarikTH opened this issue Feb 23, 2019 · 1 comment
Closed

c++17 requirement for testing private members #188

YarikTH opened this issue Feb 23, 2019 · 1 comment

Comments

@YarikTH
Copy link

YarikTH commented Feb 23, 2019

Description

I tried to use new feature from #76 that was released recently and got following erorrs from compiler.

error C7525: inline variables require at least '/std:c++17'
error C2131: expression did not evaluate to a constant
note: a non-constant (sub-)expression was encountered

It seems that current feature implementation supported only for c++17. Is it possible to backport it to c++11 (c++14)?
Another option that will work - allow to disable TEST_CASE_CLASS if c++std is less than c++17.
Otherwise I either have to give up using TEST_CASE_CLASS or I have to wrap every TEST_CASE_CLASS usage with macros that checks c++std version,

Steps to reproduce

Compile example from #76, using msvc15 and c++14.

Extra information

  • doctest version: v2.2.3
  • Operating System: Windows 7
  • Compiler+version: MSVC 15.0
@onqtam
Copy link
Member

onqtam commented Feb 23, 2019

It's not possible to backport to C++14 or 11. I'll think about disabling it, but I'm not sure if __cplusplus has the C++17 value for MSVC 2017 with /std:c++latest so I don't know if it's OK for doctest to check against __cplusplus.

However You could disable it on your own however you like for now by using the following after including the doctest header:

#include <doctest.h>

#ifdef MY_CUSTOM_CONDITION

#undef TEST_CASE_CLASS
#define TEST_CASE_CLASS(...) template <typename UNUSED_T> static inline void f()

#endif

@onqtam onqtam closed this as completed in f4053cb Mar 23, 2019
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