Skip to content

visit_format_arg hiding of 128-bit ints is still broken #139582

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

Open
t3nsor opened this issue May 12, 2025 · 1 comment · May be fixed by #139662
Open

visit_format_arg hiding of 128-bit ints is still broken #139582

t3nsor opened this issue May 12, 2025 · 1 comment · May be fixed by #139662
Labels
format C++20 std::format or std::print, and anything related to them libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@t3nsor
Copy link

t3nsor commented May 12, 2025

libstdc++ fixed a bug where 128-bit ints are visible to visitors passed to std::visit_format_arg. There was an attempt to do the same in libc++ but it is insufficient. Although 128-bit int types are now wrapped in handles before being passed to the user-provided visitor, the current libc++ still requires overload resolution to succeed for passing 128-bit int types directly to the user-provided visitor, as can be seen in this godbolt link. https://godbolt.org/z/r5vj31M3v

@frederick-vs-ja frederick-vs-ja added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. format C++20 std::format or std::print, and anything related to them and removed new issue labels May 12, 2025
@frederick-vs-ja
Copy link
Contributor

Looks like that these places are problematic.

# if _LIBCPP_HAS_INT128
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__i128_);
# else
__libcpp_unreachable();
# endif

# if _LIBCPP_HAS_INT128
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__u128_);
# else
__libcpp_unreachable();
# endif

# if _LIBCPP_HAS_INT128
return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__i128_);
# else
__libcpp_unreachable();
# endif

# if _LIBCPP_HAS_INT128
return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__u128_);
# else
__libcpp_unreachable();
# endif

I guess it's better to change __visit_format_arg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format C++20 std::format or std::print, and anything related to them libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants