Skip to content

Suppress new MSVC warning C5278 "adding a specialization for 'type trait' has undefined behavior" #118727

@CaseyCarter

Description

@CaseyCarter

MSVC is adding a new warning that will be emitted for program-defined partial and explicit specializations of the Standard Library type traits defined in [type.traits] per [meta.rqmts]/4. MSVC implements many of the type traits directly in the compiler, so the manifestation of the undefined behavior is generally that we ignore these specializations. We're hoping the warning will reduce confusion for users who don't know these specializations are forbidden, and emitting a warning seems less hostile than just silently ignoring the specializations.

It's extremely likely that a future release of MSVC with this warning will diagnose specializations in libc++ if the warning isn't suppressed e.g. with #pragma warning(disable : 5278). I'm not certain how much you folks support MSVC, but we thought you'd like a heads up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.platform:windowswontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions