Skip to content

std::any is still broken with visbility=hidden and libc++ when used cross DSO boundaries #133725

Closed as not planned
@milianw

Description

@milianw

This is related to #48743 which seems to have fixed this issue for libstdc++, but apparently there are remaining problems when using libc++:

libc++ with clang-20.1.0: https://godbolt.org/z/4TW4rMYoe note that the typeid name is the same, but the hash differs already:

NSt3__110shared_ptrI10WrappedIntEE 134520565932116
NSt3__110shared_ptrI10WrappedIntEE 105617327562758

this then leads to:

libc++abi: terminating due to uncaught exception of type std::bad_any_cast: bad any cast
Program terminated with signal: SIGSEGV

If we don't enforce libc++ and thus default to libstdc++ then everything works:

https://godbolt.org/z/bsGvfzWsh

St10shared_ptrI10WrappedIntE 6190920035151885185
St10shared_ptrI10WrappedIntE 6190920035151885185

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions