Skip to content

128-bit integers printing not supported in stl implementation #22089

Closed

Description

@yurivict
Bugzilla Link 21715
Resolution WONTFIX
Resolved on Feb 07, 2019 10:07
Version unspecified
OS All
CC @mclow,@zygoloid

Extended Description

---testcase---
#include

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') 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);

Activity

  1. yurivict commented on Dec 3, 2014

    @yurivict
    Author

    assigned to @mclow

  2. mclow commented on Dec 3, 2014

    @mclow
    Contributor

    Note - you get the same behavior with libstdc++ (gcc 4.9.2)

  3. yurivict commented on Dec 3, 2014

    @yurivict
    Author

    I know, thanks. But llvm should be ahead of the game -)

  4. mclow commented on Dec 8, 2014

    @mclow
    Contributor

    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.

  5. mclow commented on Feb 7, 2019

    @mclow
    Contributor

    Looking back, four years later.
    We're not going to do this. This is not worth an ABI break.

    Closing as "Wontfix".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ABIApplication Binary InterfacebugzillaIssues migrated from bugzillalibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.wontfixIssue is real, but we can't or won't fix it. Not invalid

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions