LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 41915 - Implement CWG 1496
Summary: Implement CWG 1496
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: C++17 (show other bugs)
Version: trunk
Hardware: PC Windows NT
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-16 12:40 PDT by Casey Carter
Modified: 2020-01-07 04:14 PST (History)
7 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Casey Carter 2019-05-16 12:40:44 PDT
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.