================
@@ -2794,6 +2882,22 @@ void Sema::DiagnoseTypeTraitDetails(const Expr *E) {
case UTT_IsAbstract:
DiagnoseNonAbstractReason(*this, E->getBeginLoc(), Args[0]);
break;
+ case TT_IsTriviallyConstructible:
+ if (StdName == TriviallyCopyConstructibleName) {
+ // std::is_trivially_copy_constructible<T>
+ if (Args.size() == 1)
+ DiagnoseNonTriviallyCopyConstructibleReason(*this, E->getBeginLoc(),
+ Args[0]);
+ } else if (StdName.empty() && Args.size() == 2) {
+ // Builtin: check that the second arg is `cv T &` (copy-construction
+ // shape).
+ if (const auto *LVRef = Args[1]->getAs<LValueReferenceType>()) {
+ if (Context.hasSameUnqualifiedType(Args[0], LVRef->getPointeeType()))
+ DiagnoseNonTriviallyCopyConstructibleReason(*this, E->getBeginLoc(),
+ Args[0]);
+ }
+ }
----------------
pesdarshan wrote:
it handles direct `__is_trivially_constructible(T, const T&)` calls which is
how libc++ implements the trait 11 of my 12 direct tests use it. If you would
rather limit this to the std spelling I can remove it and move those tests to
std spellings.
https://github.com/llvm/llvm-project/pull/225487
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits