@@ -167,7 +167,7 @@ C++2c implementation status
Disallow Binding a Returned Glvalue to a Temporary
https://wg21.link/P2748R5;>P2748R5
- No
+ Clang 19
vogelsgesang wrote:
Ah, I just saw this was already fixed in the meantime - nevermind
@@ -167,7 +167,7 @@ C++2c implementation status
Disallow Binding a Returned Glvalue to a Temporary
https://wg21.link/P2748R5;>P2748R5
- No
+ Clang 19
vogelsgesang wrote:
Should be `class="unreleased"` instead of `class="full"`
https://github.com/yronglin closed
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
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/89942
>From 8c5f1d0f92d77bffec88759c19133a0bac130f32 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Wed, 24 Apr 2024 23:36:10 +0800
Subject: [PATCH 1/7] [Clang] Implement P2748R5 "Disallow Binding a Returned
Glvalue
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/89942
>From 8c5f1d0f92d77bffec88759c19133a0bac130f32 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Wed, 24 Apr 2024 23:36:10 +0800
Subject: [PATCH 1/7] [Clang] Implement P2748R5 "Disallow Binding a Returned
Glvalue
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/89942
>From 8c5f1d0f92d77bffec88759c19133a0bac130f32 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Wed, 24 Apr 2024 23:36:10 +0800
Subject: [PATCH 1/7] [Clang] Implement P2748R5 "Disallow Binding a Returned
Glvalue
https://github.com/yronglin edited
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
https://github.com/yronglin edited
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
yronglin wrote:
> LGTM modulo comment to shorten + test to add Thanks a lot for this PR!
Thanks for your review and help!
https://github.com/llvm/llvm-project/pull/89942
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++26 -fsyntax-only -verify %s
+
+auto&& f1() {
+ return 42; // expected-error{{returning reference to local temporary object}}
+}
+const double& f2() {
+ static int x = 42;
+ return x; // expected-error{{returning reference to local
@@ -8340,8 +8340,54 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/89942
>From 8c5f1d0f92d77bffec88759c19133a0bac130f32 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Wed, 24 Apr 2024 23:36:10 +0800
Subject: [PATCH 1/7] [Clang] Implement P2748R5 "Disallow Binding a Returned
Glvalue
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++26 -fsyntax-only -verify %s
+
+auto&& f1() {
+ return 42; // expected-error{{returning reference to local temporary object}}
+}
+const double& f2() {
+ static int x = 42;
+ return x; // expected-error{{returning reference to local
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++26 -fsyntax-only -verify %s
+
+auto&& f1() {
+ return 42; // expected-error{{returning reference to local temporary object}}
+}
+const double& f2() {
+ static int x = 42;
+ return x; // expected-error{{returning reference to local
https://github.com/cor3ntin edited
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
@@ -8340,8 +8340,54 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
https://github.com/cor3ntin approved this pull request.
LGTM modulo comment to shorten + test to add
Thanks a lot for this PR!
https://github.com/llvm/llvm-project/pull/89942
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/89942
>From 8c5f1d0f92d77bffec88759c19133a0bac130f32 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Wed, 24 Apr 2024 23:36:10 +0800
Subject: [PATCH 1/6] [Clang] Implement P2748R5 "Disallow Binding a Returned
Glvalue
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff 21ef187654c819fd097171afcc6c9855dccdb36d
0ee6abe93159a29052af3ef9befff6a7e029eb31 --
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/89942
>From 8c5f1d0f92d77bffec88759c19133a0bac130f32 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Wed, 24 Apr 2024 23:36:10 +0800
Subject: [PATCH 1/3] [Clang] Implement P2748R5 "Disallow Binding a Returned
Glvalue
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
https://github.com/yronglin edited
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
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -9950,6 +9950,8 @@ def warn_ret_stack_addr_ref : Warning<
def warn_ret_local_temp_addr_ref : Warning<
"returning %select{address of|reference to}0 local temporary object">,
InGroup;
+def err_ret_local_temp_addr_ref : Error<
+ "returning %select{address of|reference
@@ -9950,6 +9950,8 @@ def warn_ret_stack_addr_ref : Warning<
def warn_ret_local_temp_addr_ref : Warning<
"returning %select{address of|reference to}0 local temporary object">,
InGroup;
+def err_ret_local_temp_addr_ref : Error<
+ "returning %select{address of|reference
https://github.com/erichkeane approved this pull request.
1 Nit, else LGTM, the CWG issue change seems sensible, as does the rest.
https://github.com/llvm/llvm-project/pull/89942
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/erichkeane edited
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
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
yronglin wrote:
> DR changes look good. @erichkeane mind giving CWG650 test a quick look?
Thanks for your review!
https://github.com/llvm/llvm-project/pull/89942
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++26 -fsyntax-only -verify %s
+
+auto&& f1() {
+ return 42; // expected-error{{returning reference to local temporary object}}
+}
+const double& f2() {
+ static int x = 42;
+ return x; // expected-error{{returning reference to local
https://github.com/frederick-vs-ja edited
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
https://github.com/frederick-vs-ja edited
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
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++26 -fsyntax-only -verify %s
+
+auto&& f1() {
+ return 42; // expected-error{{returning reference to local temporary object}}
+}
+const double& f2() {
+ static int x = 42;
+ return x; // expected-error{{returning reference to local
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++26 -fsyntax-only -verify %s
+
+auto&& f1() {
+ return 42; // expected-error{{returning reference to local temporary object}}
+}
+const double& f2() {
+ static int x = 42;
+ return x; // expected-error{{returning reference to local
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
https://github.com/Endilll edited
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
https://github.com/Endilll edited
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
@@ -4,7 +4,7 @@
// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o -
-fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s
--check-prefixes CHECK
// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o -
https://github.com/Endilll commented:
LGTM
@erichkeane mind giving CWG650 test a quick look?
https://github.com/llvm/llvm-project/pull/89942
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/cor3ntin edited
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
https://github.com/cor3ntin commented:
Thanks for working on this. you will also need to modify cxx_status.html
https://github.com/llvm/llvm-project/pull/89942
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -8340,8 +8340,17 @@ void Sema::checkInitializerLifetime(const
InitializedEntity ,
<< Entity.getType()->isReferenceType() << CLE->getInitializer() <<
2
<< DiagRange;
} else {
-Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
-
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: None (yronglin)
Changes
Implement P2748R5 "Disallow Binding a Returned Glvalue to a Temporary"
https://wg21.link/P2748R5
---
Full diff: https://github.com/llvm/llvm-project/pull/89942.diff
5 Files Affected:
- (modified)
https://github.com/yronglin edited
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
52 matches
Mail list logo