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

Gnc numeric operators #1861

Merged

Conversation

christopherlam
Copy link
Contributor

@jralls the GncNumeric <=> int64_t comparison operators don't compile.

test-gnc-numeric.cpp:443:23: note: candidate 2: 'operator>=(double, int)' (built-in)

  443 |     EXPECT_TRUE (b >= 0);
      |                       ^

test-gnc-numeric.cpp:444:23: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [-Werror]

@christopherlam christopherlam force-pushed the gnc-numeric-operators branch 2 times, most recently from 91f4866 to f8962e7 Compare January 28, 2024 09:02
@jralls
Copy link
Member

jralls commented Jan 28, 2024

@christopherlam That's because 0 isn't an int64_t it's an int, i.e. an int32_t. The error is telling you that it can be implicitly cast either to a bool or an int64_t so the compiler can't tell which one you want.

The solution is actually part of your patch, in the first line of context: Change it to INT64_C(0) and it should work.

@code-gnucash-org code-gnucash-org merged commit 928f924 into Gnucash:stable Jan 29, 2024
4 checks passed
@christopherlam christopherlam deleted the gnc-numeric-operators branch January 29, 2024 00:57
@christopherlam
Copy link
Contributor Author

Ok, wasn't obvious (to me).

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 this pull request may close these issues.

3 participants