C++11 nullptr #27

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

Projects

None yet

2 participants

@tbenthompson
tbenthompson commented Jun 23, 2016 edited

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: philsquared/Catch#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
Owner
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

Awesome. Thanks.

@onqtam onqtam added a commit that referenced this issue Aug 1, 2016
@onqtam fixed #27 7e6e7de
@onqtam onqtam added a commit that closed this issue Sep 21, 2016
@onqtam fixed #27 d1737e4
@onqtam onqtam closed this in d1737e4 Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment