Skip to content

Implement CWG 1496 #41260

@CaseyCarter

Description

@CaseyCarter
Bugzilla Link 41915
Version trunk
OS Windows NT
CC @kamleshbhalui,@riccibruno,@zygoloid,@tstellar

Extended Description

Per CWG 1496 and C++17, a trivial class "...has one or more default constructors, all of which are either trivial or deleted and at least one of which is not deleted."

Nevertheless, clang trunk diagnoses this well-formed TU (https://godbolt.org/z/a5Aflw):

template<class T>
constexpr bool is_trivial = __is_trivially_constructible(T)
    && __is_trivially_copyable(T);

struct NonTrivial { NonTrivial() = delete; };

static_assert(!is_trivial<NonTrivial>); // succeeds
static_assert(!__is_trivial(NonTrivial)); // fails (and should not)

as ill-formed since __is_trivial(NonTrivial) is incorrectly true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++17clang: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