https://github.com/efriedma-quic closed
https://github.com/llvm/llvm-project/pull/132990
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/efriedma-quic updated
https://github.com/llvm/llvm-project/pull/132990
Rate limit ยท GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,
https://github.com/cor3ntin edited
https://github.com/llvm/llvm-project/pull/132990
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3629,17 +3644,17 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const
Expr *E,
Result = VD->getEvaluatedValue();
- // C++23 [expr.const]p8
- // ... For such an object that is not usable in constant expressions, the
- // dynamic type of the object is constexpr-un
https://github.com/cor3ntin approved this pull request.
LGTM modulo nit
https://github.com/llvm/llvm-project/pull/132990
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
t3nsor wrote:
No opinions about the code, but on the reflector we did agree that rejecting
those initialization cases was the right thing to do.
https://github.com/llvm/llvm-project/pull/132990
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
h
@@ -3629,17 +3644,17 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const
Expr *E,
Result = VD->getEvaluatedValue();
- // C++23 [expr.const]p8
- // ... For such an object that is not usable in constant expressions, the
- // dynamic type of the object is constexpr-un
https://github.com/efriedma-quic updated
https://github.com/llvm/llvm-project/pull/132990
>From 2873bb1aee5470ecd7fa66c1f255bfe8b26dbc68 Mon Sep 17 00:00:00 2001
From: Eli Friedman
Date: Mon, 17 Mar 2025 11:20:21 -0700
Subject: [PATCH 1/2] [clang] fix constexpr-unknown handling of
self-referen
https://github.com/efriedma-quic commented:
Addressed review comments. We now reject g3() and g5(), the cases that
involved using a local variable in a constexpr function in its own initializer.
https://github.com/llvm/llvm-project/pull/132990
___
cf
https://github.com/efriedma-quic updated
https://github.com/llvm/llvm-project/pull/132990
>From 2873bb1aee5470ecd7fa66c1f255bfe8b26dbc68 Mon Sep 17 00:00:00 2001
From: Eli Friedman
Date: Mon, 17 Mar 2025 11:20:21 -0700
Subject: [PATCH 1/3] [clang] fix constexpr-unknown handling of
self-referen
@@ -177,3 +177,50 @@ namespace extern_reference_used_as_unknown {
int y;
constinit int& g = (x,y); // expected-warning {{left operand of comma
operator has no effect}}
}
+
+namespace uninit_reference_used {
+ int y;
+ constexpr int &r = r; // expected-error {{must be ini
@@ -177,3 +177,50 @@ namespace extern_reference_used_as_unknown {
int y;
constinit int& g = (x,y); // expected-warning {{left operand of comma
operator has no effect}}
}
+
+namespace uninit_reference_used {
+ int y;
+ constexpr int &r = r; // expected-error {{must be ini
@@ -177,3 +177,50 @@ namespace extern_reference_used_as_unknown {
int y;
constinit int& g = (x,y); // expected-warning {{left operand of comma
operator has no effect}}
}
+
+namespace uninit_reference_used {
+ int y;
+ constexpr int &r = r; // expected-error {{must be ini
cor3ntin wrote:
> > Do you intend to backport this change to 20?
>
> The weird behavior only shows up if you refer to a reference variable inside
> its own initializer, as far as I can tell. Maybe not worth backporting, even
> if it is a regression, because people shouldn't be writing code lik
@@ -177,3 +177,50 @@ namespace extern_reference_used_as_unknown {
int y;
constinit int& g = (x,y); // expected-warning {{left operand of comma
operator has no effect}}
}
+
+namespace uninit_reference_used {
+ int y;
+ constexpr int &r = r; // expected-error {{must be ini
@@ -3629,17 +3644,17 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const
Expr *E,
Result = VD->getEvaluatedValue();
- // C++23 [expr.const]p8
- // ... For such an object that is not usable in constant expressions, the
- // dynamic type of the object is constexpr-un
efriedma-quic wrote:
> Do you intend to backport this change to 20?
The weird behavior only shows up if you refer to a reference variable inside
its own initializer, as far as I can tell. Maybe not worth backporting, even
if it is a regression, because people shouldn't be writing code like th
@@ -177,3 +177,50 @@ namespace extern_reference_used_as_unknown {
int y;
constinit int& g = (x,y); // expected-warning {{left operand of comma
operator has no effect}}
}
+
+namespace uninit_reference_used {
+ int y;
+ constexpr int &r = r; // expected-error {{must be ini
https://github.com/cor3ntin edited
https://github.com/llvm/llvm-project/pull/132990
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3485,11 +3485,27 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const
Expr *E,
APValue::LValueBase Base(VD, Frame ? Frame->Index : 0, Version);
+ auto CheckUninitReference = [&] {
+if (!Result->hasValue() && VD->getType()->isReferenceType()) {
+ // We can
@@ -177,3 +177,50 @@ namespace extern_reference_used_as_unknown {
int y;
constinit int& g = (x,y); // expected-warning {{left operand of comma
operator has no effect}}
}
+
+namespace uninit_reference_used {
+ int y;
+ constexpr int &r = r; // expected-error {{must be ini
@@ -3629,17 +3644,17 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const
Expr *E,
Result = VD->getEvaluatedValue();
- // C++23 [expr.const]p8
- // ... For such an object that is not usable in constant expressions, the
- // dynamic type of the object is constexpr-un
@@ -3485,11 +3485,27 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const
Expr *E,
APValue::LValueBase Base(VD, Frame ? Frame->Index : 0, Version);
+ auto CheckUninitReference = [&] {
+if (!Result->hasValue() && VD->getType()->isReferenceType()) {
+ // We can
@@ -3629,17 +3644,17 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const
Expr *E,
Result = VD->getEvaluatedValue();
- // C++23 [expr.const]p8
- // ... For such an object that is not usable in constant expressions, the
- // dynamic type of the object is constexpr-un
https://github.com/cor3ntin commented:
Thanks.
I think the direction makes sense
Do you intend to backport this change to 20?
https://github.com/llvm/llvm-project/pull/132990
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.
https://github.com/efriedma-quic created
https://github.com/llvm/llvm-project/pull/132990
Usually, in constant evaluation, references which are local to the evaluation
have to be initialized before they're accessed. However, there's one funny
special case: the initializer of a reference can r
https://github.com/efriedma-quic updated
https://github.com/llvm/llvm-project/pull/132990
>From 2873bb1aee5470ecd7fa66c1f255bfe8b26dbc68 Mon Sep 17 00:00:00 2001
From: Eli Friedman
Date: Mon, 17 Mar 2025 11:20:21 -0700
Subject: [PATCH] [clang] fix constexpr-unknown handling of self-references.
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 cc86d7cb191a64489e837c68f299abb930f5c6cb
f5195b8d3d7ac00e8a0a54c10be485d69a576ba5 --e
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Eli Friedman (efriedma-quic)
Changes
Usually, in constant evaluation, references which are local to the evaluation
have to be initialized before they're accessed. However, there's one funny
special case: the initializer of a reference ca
29 matches
Mail list logo