Skip to content

[libc++] std::type_index equality broken for anonymous namespace classes with same name with NonUnique implementation #79367

Open
@aeubanks

Description

@aeubanks

// ========================================================================== //
describes the various ways of implementing type_info comparison.

With _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION = 2, classes in different anonymous namespace with the same name are considered equal. #44894 already reported this, but the issue was merely worked around for Apple builds.

I believe libstdc++ handles this correctly by not doing the name comparison when it detects these sorts of anonymous namespace classes: https://github.com/gcc-mirror/gcc/blob/aedfdd340cbb4a97a8f6d432720a4df374c1e467/libstdc%2B%2B-v3/libsupc%2B%2B/typeinfo#L205.

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions