https://github.com/Endilll commented:
`Sema.h` changes look good.
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/cor3ntin approved this pull request.
LGTM too
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/erichkeane approved this pull request.
This seems reasonable to me, I think @cor3ntin should also approve before
committing though.
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
katzdm wrote:
Friendly ping - No worries if more time is needed to consider the impact of
this one, but wanted to check if any more changes are needed at this time.
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
https://github.com/cor3ntin edited
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -16548,11 +16548,10 @@ static void CheckImplicitConversion(Sema , Expr *E,
QualType T,
std::string PrettySourceValue = toString(Value, 10);
std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange);
-S.DiagRuntimeBehavior(
-
@@ -16548,11 +16548,10 @@ static void CheckImplicitConversion(Sema , Expr *E,
QualType T,
std::string PrettySourceValue = toString(Value, 10);
std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange);
-S.DiagRuntimeBehavior(
-
@@ -16548,11 +16548,10 @@ static void CheckImplicitConversion(Sema , Expr *E,
QualType T,
std::string PrettySourceValue = toString(Value, 10);
std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange);
-S.DiagRuntimeBehavior(
-
@@ -16548,11 +16548,10 @@ static void CheckImplicitConversion(Sema , Expr *E,
QualType T,
std::string PrettySourceValue = toString(Value, 10);
std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange);
-S.DiagRuntimeBehavior(
-
@@ -18562,9 +18553,7 @@ static bool isNonlocalVariable(const Decl *D) {
/// class X. If the declaration had a scope specifier, a scope will have
/// been created and passed in for this purpose. Otherwise, S will be null.
void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl
@@ -16548,11 +16548,10 @@ static void CheckImplicitConversion(Sema , Expr *E,
QualType T,
std::string PrettySourceValue = toString(Value, 10);
std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange);
-S.DiagRuntimeBehavior(
-
@@ -18573,25 +18562,35 @@ void Sema::ActOnCXXEnterDeclInitializer(Scope *S,
Decl *D) {
if (S && D->isOutOfLine())
EnterDeclaratorContext(S, D->getDeclContext());
- // If we are parsing the initializer for a static data member, push a
- // new expression evaluation
https://github.com/katzdm updated
https://github.com/llvm/llvm-project/pull/89565
>From 218ffb6d5a03c96d46bfecdb4490277809f5b62e Mon Sep 17 00:00:00 2001
From: Dan Katz
Date: Tue, 16 Apr 2024 17:14:50 -0400
Subject: [PATCH 1/8] Fix bug with constexpr initialization.
---
@@ -16548,11 +16548,10 @@ static void CheckImplicitConversion(Sema , Expr *E,
QualType T,
std::string PrettySourceValue = toString(Value, 10);
std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange);
-S.DiagRuntimeBehavior(
-
@@ -18573,25 +18562,35 @@ void Sema::ActOnCXXEnterDeclInitializer(Scope *S,
Decl *D) {
if (S && D->isOutOfLine())
EnterDeclaratorContext(S, D->getDeclContext());
- // If we are parsing the initializer for a static data member, push a
- // new expression evaluation
@@ -18562,9 +18553,7 @@ static bool isNonlocalVariable(const Decl *D) {
/// class X. If the declaration had a scope specifier, a scope will have
/// been created and passed in for this purpose. Otherwise, S will be null.
void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl
@@ -18562,9 +18553,7 @@ static bool isNonlocalVariable(const Decl *D) {
/// class X. If the declaration had a scope specifier, a scope will have
/// been created and passed in for this purpose. Otherwise, S will be null.
void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl
@@ -16548,11 +16548,10 @@ static void CheckImplicitConversion(Sema , Expr *E,
QualType T,
std::string PrettySourceValue = toString(Value, 10);
std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange);
-S.DiagRuntimeBehavior(
-
@@ -2559,25 +2559,30 @@ Decl
*Parser::ParseDeclarationAfterDeclaratorAndAttributes(
Parser
Declarator
Decl *ThisDecl;
+bool Entered;
InitializerScopeRAII(Parser , Declarator , Decl *ThisDecl)
-: P(P), D(D), ThisDecl(ThisDecl) {
+:
@@ -18573,25 +18562,35 @@ void Sema::ActOnCXXEnterDeclInitializer(Scope *S,
Decl *D) {
if (S && D->isOutOfLine())
EnterDeclaratorContext(S, D->getDeclContext());
- // If we are parsing the initializer for a static data member, push a
- // new expression evaluation
@@ -18573,25 +18562,35 @@ void Sema::ActOnCXXEnterDeclInitializer(Scope *S,
Decl *D) {
if (S && D->isOutOfLine())
EnterDeclaratorContext(S, D->getDeclContext());
- // If we are parsing the initializer for a static data member, push a
- // new expression evaluation
efriedma-quic wrote:
The approach makes sense. I'll defer to someone who's more familiar with this
code for the full review.
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/katzdm updated
https://github.com/llvm/llvm-project/pull/89565
>From 218ffb6d5a03c96d46bfecdb4490277809f5b62e Mon Sep 17 00:00:00 2001
From: Dan Katz
Date: Tue, 16 Apr 2024 17:14:50 -0400
Subject: [PATCH 1/7] Fix bug with constexpr initialization.
---
https://github.com/katzdm edited https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/katzdm updated
https://github.com/llvm/llvm-project/pull/89565
>From 218ffb6d5a03c96d46bfecdb4490277809f5b62e Mon Sep 17 00:00:00 2001
From: Dan Katz
Date: Tue, 16 Apr 2024 17:14:50 -0400
Subject: [PATCH 1/7] Fix bug with constexpr initialization.
---
@@ -1032,17 +1043,15 @@ int f() {
namespace GH57682 {
void test() {
- constexpr auto l1 = []() consteval { // expected-error {{cannot take address
of consteval call operator of '(lambda at}} \
- // expected-note 2{{declared here}}
+
@@ -244,8 +244,8 @@ namespace UndefinedBehavior {
constexpr int n13 = n5 + n5; // expected-error {{constant expression}}
expected-note {{value -4294967296 is outside the range of }}
constexpr int n14 = n3 - n5; // expected-error {{constant expression}}
expected-note
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 6904e0e8852a587b49a673055997e88855f219ea
ec17c7668650add013f321453007191740e144e6 --
@@ -2554,16 +2554,27 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_if_present(D))
+return
katzdm wrote:
This ended up being a lot more subtle than I expected. My latest push proposes
a different solution; @cor3ntin and @efriedma-quic - please let me know your
thoughts.
This PR turns out to be a bug fix on the implementation of
[P2564R3](https://wg21.link/p2564r3); as such, it
https://github.com/katzdm updated
https://github.com/llvm/llvm-project/pull/89565
>From 218ffb6d5a03c96d46bfecdb4490277809f5b62e Mon Sep 17 00:00:00 2001
From: Dan Katz
Date: Tue, 16 Apr 2024 17:14:50 -0400
Subject: [PATCH 1/6] Fix bug with constexpr initialization.
---
@@ -2554,16 +2554,27 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_if_present(D))
+return
@@ -2554,16 +2554,27 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_if_present(D))
+return
@@ -2554,16 +2554,27 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_if_present(D))
+return
@@ -2554,16 +2554,27 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_if_present(D))
+return
@@ -244,8 +244,8 @@ namespace UndefinedBehavior {
constexpr int n13 = n5 + n5; // expected-error {{constant expression}}
expected-note {{value -4294967296 is outside the range of }}
constexpr int n14 = n3 - n5; // expected-error {{constant expression}}
expected-note
@@ -244,8 +244,8 @@ namespace UndefinedBehavior {
constexpr int n13 = n5 + n5; // expected-error {{constant expression}}
expected-note {{value -4294967296 is outside the range of }}
constexpr int n14 = n3 - n5; // expected-error {{constant expression}}
expected-note
https://github.com/erichkeane commented:
I don't have a great idea on this one, but losing the diagnostics seems
incorrect. I think the whole initializer should probably be treated in 1 shot
as a constant expr (so move the ConstantExpr to the top (above the
`ImplicitCastExpr` in your
@@ -9,8 +9,7 @@ using MaxBitInt = _BitInt(128);
constexpr _BitInt(2) A = 0;
constexpr _BitInt(2) B = A + 1;
-constexpr _BitInt(2) C = B + 1; // expected-warning {{from 2 to -2}} \
-// ref-warning {{from 2 to -2}}
+constexpr _BitInt(2) C = B +
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -244,8 +244,8 @@ namespace UndefinedBehavior {
constexpr int n13 = n5 + n5; // expected-error {{constant expression}}
expected-note {{value -4294967296 is outside the range of }}
constexpr int n14 = n3 - n5; // expected-error {{constant expression}}
expected-note
@@ -2554,16 +2554,26 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_or_null(D))
katzdm wrote:
@@ -1032,17 +1043,15 @@ int f() {
namespace GH57682 {
void test() {
- constexpr auto l1 = []() consteval { // expected-error {{cannot take address
of consteval call operator of '(lambda at}} \
- // expected-note 2{{declared here}}
+
@@ -2554,16 +2554,26 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_or_null(D))
katzdm wrote:
https://github.com/katzdm commented:
@cor3ntin Thanks for your review; this is ready for another look.
Note that the use of a full `ExpressionEvaluationContext` caused a handful of
other tests to start failing - in particular, ones that previously expected
warnings related to changes of value
https://github.com/katzdm edited https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/katzdm updated
https://github.com/llvm/llvm-project/pull/89565
>From a3f8a8648e2002273d47d7886b29fb02c728b5b7 Mon Sep 17 00:00:00 2001
From: Dan Katz
Date: Tue, 16 Apr 2024 17:14:50 -0400
Subject: [PATCH 1/5] Fix bug with constexpr initialization.
---
https://github.com/katzdm updated
https://github.com/llvm/llvm-project/pull/89565
>From a3f8a8648e2002273d47d7886b29fb02c728b5b7 Mon Sep 17 00:00:00 2001
From: Dan Katz
Date: Tue, 16 Apr 2024 17:14:50 -0400
Subject: [PATCH 1/2] Fix bug with constexpr initialization.
---
katzdm wrote:
> I think the change makes sense. Can you add a release note?
Appreciate the reminder!
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -1032,17 +1043,15 @@ int f() {
namespace GH57682 {
void test() {
- constexpr auto l1 = []() consteval { // expected-error {{cannot take address
of consteval call operator of '(lambda at}} \
- // expected-note 2{{declared here}}
+
@@ -2554,16 +2554,26 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_or_null(D))
cor3ntin wrote:
@@ -2554,16 +2554,26 @@ Decl *Parser::ParseDeclarationAfterDeclarator(
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
+static bool isConstexprVariable(const Decl *D) {
+ if (const VarDecl *Var = dyn_cast_or_null(D))
+return Var->isConstexpr();
cor3ntin wrote:
I think the change makes sense.
Can you add a release note?
https://github.com/llvm/llvm-project/pull/89565
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Daniel M. Katz (katzdm)
Changes
The following program produces a diagnostic in Clang and EDG, but compiles
correctly in GCC and MSVC:
```cpp
#include vector
consteval std::vectorint fn() { return {1,2,3}; }
constexpr int a = fn()[1];
```
https://github.com/katzdm created
https://github.com/llvm/llvm-project/pull/89565
The following program produces a diagnostic in Clang and EDG, but compiles
correctly in GCC and MSVC:
```cpp
#include
consteval std::vector fn() { return {1,2,3}; }
constexpr int a = fn()[1];
```
Clang's
55 matches
Mail list logo