diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 91b89a0946555..536525da8a628 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -310,6 +310,8 @@ Non-comprehensive list of changes in this release different than before. - Fixed a crash when a VLA with an invalid size expression was used within a ``sizeof`` or ``typeof`` expression. (#GH138444) +- Deprecation warning is emitted for the deprecated ``__reference_binds_to_temporary`` intrinsic. + ``__reference_constructs_from_temporary`` should be used instead. (#GH44056) New Compiler Flags ------------------ diff --git a/clang/lib/Sema/SemaTypeTraits.cpp b/clang/lib/Sema/SemaTypeTraits.cpp index 7bf3c8eaabf4b..04f54d7044e4f 100644 --- a/clang/lib/Sema/SemaTypeTraits.cpp +++ b/clang/lib/Sema/SemaTypeTraits.cpp @@ -1458,6 +1458,9 @@ void DiagnoseBuiltinDeprecation(Sema &S, TypeTrait Kind, SourceLocation KWLoc) { case UTT_IsTriviallyRelocatable: Replacement = clang::UTT_IsCppTriviallyRelocatable; break; + case BTT_ReferenceBindsToTemporary: + Replacement = clang::BTT_ReferenceConstructsFromTemporary; + break; default: return; } diff --git a/clang/test/SemaCXX/deprecated-builtins.cpp b/clang/test/SemaCXX/deprecated-builtins.cpp index fafc1da4da13e..1234c8354fcab 100644 --- a/clang/test/SemaCXX/deprecated-builtins.cpp +++ b/clang/test/SemaCXX/deprecated-builtins.cpp @@ -15,6 +15,7 @@ void f() { a = __has_trivial_constructor(A); // expected-warning-re {{__has_trivial_constructor {{.*}} use __is_trivially_constructible}} a = __has_trivial_move_constructor(A); // expected-warning-re {{__has_trivial_move_constructor {{.*}} use __is_trivially_constructible}} a = __has_trivial_destructor(A); // expected-warning-re {{__has_trivial_destructor {{.*}} use __is_trivially_destructible}} + a = __reference_binds_to_temporary(const A&, A); // expected-warning-re {{__reference_binds_to_temporary {{.*}} use __reference_constructs_from_temporary}} }