Skip to content

std::is_trivially_copyable is true when all copy/move operations are deleted #169937

@HolyBlackCat

Description

@HolyBlackCat
#include <type_traits>

struct A
{
    A(const A &) = delete;
    A(A &&) = delete;
    A &operator=(const A &) = delete;
    A &operator=(A &&) = delete;
};

static_assert(!std::is_trivially_copyable_v<A>);

Here std::is_trivially_copyable_v<A> == true, but it should be false.

"Trivially copyable" requires at least one of those 4 members to be "eligible" (https://eel.is/c++draft/class.prop#1.1), which in turn requires it to not be deleted (https://eel.is/c++draft/special#6.1).

GCC has the same bug, but MSVC correctly returns false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"duplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions