================ @@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const InitializedEntity &Entity, << Entity.getType()->isReferenceType() << CLE->getInitializer() << 2 << DiagRange; } else { - Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref) - << Entity.getType()->isReferenceType() << DiagRange; + // P2748R5: Disallow Binding a Returned Glvalue to a Temporary. + // [stmt.return]/p6: In a function whose return type is a reference, + // other than an invented function for std::is_convertible ([meta.rel]), + // a return statement that binds the returned reference to a temporary + // expression ([class.temporary]) is ill-formed. ---------------- yronglin wrote:
Sorry, I misunderstanding before. I have seen [LWG3400](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2748r5.html#ref-LWG3400), and there has a comments `This issue should be resolved by LWG [4028](https://cplusplus.github.io/LWG/lwg-active.html#4028).`, therefor, what I mean here is that should we makes `std::is_nothrow_convertible_v<int, Weird>` evaluated as `true`? https://github.com/llvm/llvm-project/pull/89942 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits