Skip to content

Commit 64f0f7e

Browse files
ZacharyHenkelroyjacobson
authored andcommitted
__has_trivial_copy should map to __is_trivially_copyable
Found during clang 15 RC1 testing due to the new diagnostic added by @royjacobson since clang 14. Uncertain if this fix meets the bar to also be applied to the release branch. If accepted, I'll need someone with commit access to submit on my behalf. Reviewed By: royjacobson, aaron.ballman, erichkeane Differential Revision: https://reviews.llvm.org/D131730
1 parent 2f9be69 commit 64f0f7e

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ The following type trait primitives are supported by Clang. Those traits marked
13731373
* ``__has_trivial_move_assign`` (GNU, Microsoft):
13741374
Deprecated, use ``__is_trivially_assignable`` instead.
13751375
* ``__has_trivial_copy`` (GNU, Microsoft):
1376-
Deprecated, use ``__is_trivially_constructible`` instead.
1376+
Deprecated, use ``__is_trivially_copyable`` instead.
13771377
* ``__has_trivial_constructor`` (GNU, Microsoft):
13781378
Deprecated, use ``__is_trivially_constructible`` instead.
13791379
* ``__has_trivial_move_constructor`` (GNU, Microsoft):

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5412,6 +5412,8 @@ void DiagnoseBuiltinDeprecation(Sema& S, TypeTrait Kind,
54125412
Replacement = BTT_IsTriviallyAssignable;
54135413
break;
54145414
case UTT_HasTrivialCopy:
5415+
Replacement = UTT_IsTriviallyCopyable;
5416+
break;
54155417
case UTT_HasTrivialDefaultConstructor:
54165418
case UTT_HasTrivialMoveConstructor:
54175419
Replacement = TT_IsTriviallyConstructible;

clang/test/SemaCXX/deprecated-builtins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void f() {
1111
a = __has_nothrow_constructor(A); // expected-warning-re {{__has_nothrow_constructor {{.*}} use __is_nothrow_constructible}}
1212
a = __has_trivial_assign(A); // expected-warning-re {{__has_trivial_assign {{.*}} use __is_trivially_assignable}}
1313
a = __has_trivial_move_assign(A); // expected-warning-re {{__has_trivial_move_assign {{.*}} use __is_trivially_assignable}}
14-
a = __has_trivial_copy(A); // expected-warning-re {{__has_trivial_copy {{.*}} use __is_trivially_constructible}}
14+
a = __has_trivial_copy(A); // expected-warning-re {{__has_trivial_copy {{.*}} use __is_trivially_copyable}}
1515
a = __has_trivial_constructor(A); // expected-warning-re {{__has_trivial_constructor {{.*}} use __is_trivially_constructible}}
1616
a = __has_trivial_move_constructor(A); // expected-warning-re {{__has_trivial_move_constructor {{.*}} use __is_trivially_constructible}}
1717
a = __has_trivial_destructor(A); // expected-warning-re {{__has_trivial_destructor {{.*}} use __is_trivially_destructible}}

0 commit comments

Comments
 (0)