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

Error including DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING #674

Open
RaniAgus opened this issue Jul 23, 2022 · 3 comments · May be fixed by #706
Open

Error including DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING #674

RaniAgus opened this issue Jul 23, 2022 · 3 comments · May be fixed by #706

Comments

@RaniAgus
Copy link

Description

I'd like to compare C strings but when defining DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING the compiler throws this error:

/usr/local/include/doctest.h:1278:89: error: ‘value’ does not name a type; did you mean ‘si_value’?
 1278 |     template<class T>   struct not_char_pointer              { static DOCTEST_CONSTEXPR value = 1; };
      |                                                                                         ^~~~~
      |                                                                                         si_value
/usr/local/include/doctest.h:1279:89: error: ‘value’ does not name a type; did you mean ‘si_value’?
 1279 |     template<>          struct not_char_pointer<char*>       { static DOCTEST_CONSTEXPR value = 0; };
      |                                                                                         ^~~~~
      |                                                                                         si_value
/usr/local/include/doctest.h:1280:89: error: ‘value’ does not name a type; did you mean ‘si_value’?
 1280 |     template<>          struct not_char_pointer<const char*> { static DOCTEST_CONSTEXPR value = 0; };
      |                                                                                         ^~~~~
      |                                                                                         si_value
ninja: build stopped: subcommand failed.

Btw, it would be nice to have a specific assert for C strings. Maybe something like {REQUIRE|CHECK}_C_STRING_{EQ|NE}(actual, expected).

Steps to reproduce

Include in one file:

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#define DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
#include <doctest.h>

Test suites are defined in other files.

Extra information

  • doctest version: v2.4.9
  • Operating System: Pop OS 22.04
  • Compiler+version: g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
@PucklaJ
Copy link

PucklaJ commented Aug 7, 2022

This error does not occur on version 2.4.8

@chunhualiu
Copy link

I changed DOCTEST_CONSTEXPR to DOCTEST_CONSTEXPR int
And it works.

Saalvage added a commit that referenced this issue Oct 4, 2022
@Saalvage Saalvage linked a pull request Oct 4, 2022 that will close this issue
@Saalvage
Copy link
Member

Saalvage commented Oct 4, 2022

How embarrassing! I'm sorry everyone! Hopefully 2.4.10 will release this week, fixing it!

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

Successfully merging a pull request may close this issue.

4 participants