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

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 23:46:37 PST 2026


================
@@ -2006,15 +2006,30 @@ ExprResult Sema::BuildExpressionTrait(ExpressionTrait ET, SourceLocation KWLoc,
       ExpressionTraitExpr(KWLoc, ET, Queried, Value, RParen, Context.BoolTy);
 }
 
+// std::is_trivially_copy_constructible<T> is
+// __is_trivially_constructible(T, const T &). It is not in the generated table
+// because the std trait takes only T. Callers tell it apart from the builtin
+// by the std name recorded in ExtractedTypeTraitInfo.
+static constexpr StringRef TriviallyCopyConstructibleName =
+    "is_trivially_copy_constructible";
+
 static std::optional<TypeTrait> StdNameToTypeTrait(StringRef Name) {
+  if (Name == TriviallyCopyConstructibleName)
+    return TT_IsTriviallyConstructible;
----------------
zyn0217 wrote:

I think getting a tablegen involved makes everything worse. Maybe we want to back out #201491...

This is a good example that a builtin trait could map to multiple std type traits. And the design of EMIT_STD_NAME_CASES doesn't seem to handle this in a neat way, I'm thinking if a revert is an option.

@cor3ntin


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


More information about the cfe-commits mailing list