Const cstrings are not equal to non-const cstrings

Issue #9 resolved
Nikolaus Wittenstein
created an issue

I was trying out xUnit++ today, and ran across the following issue:

FACT("const cstrings are not equal to non-const cstrings")
{
    char foo[] = "hi";
    Check.Equal("hi", foo); //Fails, though I would expect success
    Check.Equal("hi", (const char*)foo); //Succeeds
}

Looks like it might have to do with the word "const" in the specialized template:

xUnitFailure Equal(const char *expected, const char *actual, LineInfo &&lineInfo = LineInfo()) const;

...but I don't know how to fix it.

I'm using gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2.

Comments (2)

  1. Matt Oswald repo owner

    That specific case has been fixed, and I think the end result is generic enough to take care of anything else I've missed. Please let me know if anything else comes up.

  2. Log in to comment