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++11 nullptr #27

Closed
tbenthompson opened this issue Jun 23, 2016 · 2 comments
Closed

C++11 nullptr #27

tbenthompson opened this issue Jun 23, 2016 · 2 comments

Comments

@tbenthompson
Copy link

tbenthompson commented Jun 23, 2016

Howdy,

I'm converting a test setup using Catch to doctest. Most of the process was super easy -- just a global find and replace for catch --> doctest and SECTION -> SUBCASE. But, I'm getting a couple errors.

  1. I'm using a check like:
REQUIRE(ptr == nullptr);

and getting an error like:

/home/tbent/projects/taskloaf/taskloaf/lib/doctest.h:267:63: error: ambiguous overload for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘std::nullptr_t’)
             static const bool value = sizeof(testStreamable(s << t)) == sizeof(yes);

It looks like this was an issue in Catch previously: catchorg/Catch2#80
and for me it's solved by adding this:

namespace doctest {
template <>
struct StringMaker<std::nullptr_t> {
    static String convert(std::nullptr_t) { return "nullptr"; }
};
}
  1. Comparing the size of a collection like:
REQUIRE(my_vector.size() == 4);

produces

comparison between signed and unsigned integer expressions

warnings. While, this is less of a problem than #1, it's always nice to get rid of warnings!

Cheers!

@onqtam
Copy link
Member

onqtam commented Jun 23, 2016

thanks for the reports! the 2nd is reported in issue #16

both things will be fixed for 1.1 - hopefully in 1 or 2 weeks.

@tbenthompson
Copy link
Author

Awesome. Thanks.

onqtam added a commit that referenced this issue Aug 1, 2016
@onqtam onqtam closed this as completed in d1737e4 Sep 21, 2016
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