LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 21715 - 128-bit integers printing not supported in stl implementation
Summary: 128-bit integers printing not supported in stl implementation
Status: RESOLVED WONTFIX
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC All
: P enhancement
Assignee: Marshall Clow (home)
URL:
Keywords: ABI
Depends on:
Blocks:
 
Reported: 2014-12-02 16:32 PST by Yuri
Modified: 2019-02-07 10:07 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri 2014-12-02 16:32:32 PST
---testcase---
#include <sstream>

int main() {
  std::ostringstream ss;
  __int128 i = 10;
  ss << i;
}

---errors---
i128.C:7:6: error: use of overloaded operator '<<' is ambiguous (with operand types 'std::ostringstream' (aka 'basic_ostringstream<char>') and
      '__int128')
  ss << i;
  ~~ ^  ~
/usr/include/c++/v1/ostream:183:20: note: candidate function
    basic_ostream& operator<<(bool __n);
                   ^
/usr/include/c++/v1/ostream:184:20: note: candidate function
    basic_ostream& operator<<(short __n);
                   ^
/usr/include/c++/v1/ostream:185:20: note: candidate function
    basic_ostream& operator<<(unsigned short __n);
                   ^
/usr/include/c++/v1/ostream:186:20: note: candidate function
    basic_ostream& operator<<(int __n);
                   ^
/usr/include/c++/v1/ostream:187:20: note: candidate function
    basic_ostream& operator<<(unsigned int __n);
Comment 1 Marshall Clow (home) 2014-12-02 20:28:45 PST
Note - you get the same behavior with libstdc++ (gcc 4.9.2)
Comment 2 Yuri 2014-12-02 20:48:21 PST
I know, thanks. But llvm should be ahead of the game -)
Comment 3 Marshall Clow (home) 2014-12-08 10:31:21 PST
A couple more comments.

1) This requires an ABI change - specifically, adding two additional virtual overloads to std::num_put::do_put. 

2) libc++ uses the underlying C library call sprintf (or sprintf_l, if available) to do the actual conversion. I don't think too many C libraries support this yet.
Comment 4 Marshall Clow (home) 2019-02-07 10:07:09 PST
Looking back, four years later.
We're not going to do this. This is not worth an ABI break.

Closing as "Wontfix".