[clang] [Clang] Added explanation why is_trivially_copy_constructible evaluated to false (PR #225487)

Darshan N via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 02:38:00 PST 2026


================
@@ -2007,14 +2007,26 @@ ExprResult Sema::BuildExpressionTrait(ExpressionTrait ET, SourceLocation KWLoc,
 }
 
 static std::optional<TypeTrait> StdNameToTypeTrait(StringRef Name) {
+  // std::is_trivially_copy_constructible<T> is implemented in terms of
+  // __is_trivially_constructible(T, const T &).
+  if (Name == "is_trivially_copy_constructible")
+    return TT_IsTriviallyConstructible;
----------------
pesdarshan wrote:

Hi @Tsche,
I tried this, but it doesn't build. `IsDeducible` and the new trait both have an empty spelling. `TokenKinds.def` turns the spelling into a token name (kw_ plus the spelling), so both become `kw_`, and the second one fails with "redefinition of enumerator 'kw_'". Should I change the tablegen emitter to skip the keyword for traits with no spelling, or would you prefer something else?

https://github.com/llvm/llvm-project/pull/225487


More information about the cfe-commits mailing list