Repository navigation
fix assert ambiguity: use direct bool condition instead of lambda - #7
Closed
igagis-bot wants to merge 1 commit into
Closed
igagis-bot wants to merge 1 commit into
igagis-bot wants to merge 1 commit into
Conversation
Apple clang (Xcode 26.6) reports the lambda form of utki::assert() with a by-value local capture as an ambiguous call between the bool and the std::function<bool()> overloads. Pass the condition directly as a bool expression (the form the old ASSERT macro used) to avoid the ambiguity.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7 +/- ##
==========================================
+ Coverage 48.23% 49.71% +1.48%
==========================================
Files 6 6
Lines 537 533 -4
Branches 113 111 -2
==========================================
+ Hits 259 265 +6
+ Misses 275 265 -10
Partials 3 3 ☔ View full report in Codecov by Harness. |
Contributor
Author
|
Superseded by the root-cause fix in cppfw/utki#33 (SFINAE-constrains the bool-taking assert() overloads in the header). This call-site fix only covers 2 of ~100+ assert(lambda) sites, and turns the lazy condition into an eagerly-evaluated expression (behavior change in release builds). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apple clang (Xcode 26.6) fails to resolve the overloaded call
in image_variant.hpp (both num_channels() and get_format()), reporting
"call to 'assert' is ambiguous" between the bool and
std::function<bool()> overloads.
Pass the condition directly as a bool expression (the form the old
ASSERT macro used) so the call is unambiguously the bool overload on
every compiler. Behavior is unchanged; the condition is still only
enforced in debug builds.