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

gcc warns for comparison of unsigned long long #97

Closed
colonelsammy opened this issue Jun 7, 2012 · 3 comments
Closed

gcc warns for comparison of unsigned long long #97

colonelsammy opened this issue Jun 7, 2012 · 3 comments

Comments

@colonelsammy
Copy link
Contributor

Comparison of unsigned long long to 'Y' doesn't warn for assert but does warn for REQUIRE:

    unsigned long long v = 0;
    assert(v == 0); // doesn't warn
    REQUIRE(v == 0); // warning - comparison between unsigned long long and int

catch_evaluate needs some more overloads for 'unsigned X to Y' and 'Y to unsigned X' (where 'X' is unsigned long long), e.g:

    // unsigned X to int
    template<Operator Op> bool compare( unsigned long long lhs, int rhs )
    {
        return applyEvaluator<Op>( lhs, static_cast<unsigned long long>( rhs ) );
    }
    ...
    // unsigned X to long
    template<Operator Op> bool compare( unsigned long long lhs, long rhs )
    {
        return applyEvaluator<Op>( lhs, static_cast<unsigned long long>( rhs ) );
    }
    ...
    // int to unsigned X
    template<Operator Op> bool compare( int lhs, unsigned long long rhs )
    {
        return applyEvaluator<Op>( static_cast<unsigned long long>( lhs ), rhs );
    }
    ...
    // long to unsigned X
    template<Operator Op> bool compare( long lhs, unsigned long long rhs )
    {
        return applyEvaluator<Op>( static_cast<unsigned long long>( lhs ) );
    }

Note: No warnings issued on Windows even with W4.

@philsquared
Copy link
Collaborator

Hmm... will see if I can add these in a portable way

@philsquared
Copy link
Collaborator

Better late than never. I've added this now (v1.2.1-develop.9)

@krvajal krvajal added the Resolved - pending review Issue waiting for feedback from the original author label Jan 26, 2017
@krvajal
Copy link

krvajal commented Jan 26, 2017

It seems that this was fixed a long time ago. I will close this now

@krvajal krvajal closed this as completed Jan 26, 2017
@horenmar horenmar removed the Resolved - pending review Issue waiting for feedback from the original author label Feb 6, 2017
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

4 participants