llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: A. Jiang (frederick-vs-ja) <details> <summary>Changes</summary> At the time `__reference_constructs_from_temporary` got implemented, `__reference_binds_to_temporary` was mentioned as deprecated in `LanguageExtensions.rst`, but no deprecation warning was emitted. This PR adds the previously missing warning. Closes #<!-- -->44056. --- Full diff: https://github.com/llvm/llvm-project/pull/141909.diff 3 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+2) - (modified) clang/lib/Sema/SemaTypeTraits.cpp (+3) - (modified) clang/test/SemaCXX/deprecated-builtins.cpp (+1) ``````````diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 32266fce4d3cb..e1ff28e684af5 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}} } `````````` </details> https://github.com/llvm/llvm-project/pull/141909 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits