Skip to content

is_trivially_copyable_v misbehavesΒ #38398

@llvmbot

Description

@llvmbot
Bugzilla Link 39050
Version 7.0
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@mclow,@zygoloid,@rjmccall

Extended Description

Tested on various c++17 compatible versions on godbolt.

Assuming cppreference is correct (https://en.cppreference.com/w/cpp/named_req/TriviallyCopyable) and my interpretation of their text is also correct.

std::is_trivially_copyable_v doesn't follow the standard's definition.

Example 1, Trivial non-deleted destructor :
The deleted destructor should fail the check : https://godbolt.org/z/5BOO68

Example 2, at least one copy constructor, move constructor, copy assignment operator, or move assignment operator is non-deleted :
There are no copy/move ctors or assignement operators, should fail the check : https://godbolt.org/z/APcHua

I tested on gcc with the same results. I'm assuming I've missed something.

Does libc++ use is_trivially_copyable_v internally for vector resize?

Metadata

Metadata

Assignees

Labels

ABIApplication Binary InterfacebugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"cwg-issueAn issue that was filed to the Core Working Group

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions