From 9d46db5688850a54638f6b2f6aed49c912b467df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=92=E6=95=85=E9=87=8C?= <3326284481@qq.com> Date: Sat, 3 Feb 2024 16:06:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20`F.48`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\254\2544\347\253\240-\345\207\275\346\225\260.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/C++CoreGuidelines/\347\254\2544\347\253\240-\345\207\275\346\225\260.md" "b/C++CoreGuidelines/\347\254\2544\347\253\240-\345\207\275\346\225\260.md" index f9df8280..ee774942 100644 --- "a/C++CoreGuidelines/\347\254\2544\347\253\240-\345\207\275\346\225\260.md" +++ "b/C++CoreGuidelines/\347\254\2544\347\253\240-\345\207\275\346\225\260.md" @@ -828,7 +828,7 @@ int main(){ 在编译时,GCC 编译器会立即抱怨对临时对象的引用。准确地说,临时对象的生存期随着整个表达式 `auto myInt = returnRvalueReference();` 的结束而结束。 -> **在函数调用中绑定到函数形参的临时量,存在到含这次函数调用的全表达式结尾为止:如果函数返回一个生命长于全表达式的引用,那么它会成为悬垂引用。** +> **return 语句中绑定到函数返回值的临时量不会被延续:它在返回表达式的末尾立即销毁。这种 return 语句始终返回悬垂引用。** ```text : In function 'int&& returnRvalueReference()':