[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-25 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Pushed #145755 to revise the release note with information about numeric_conversion specifically. If the underlying issue with boost::mpl::integral_c isn't actually impacting anyone, I won't worry about it. https://github.com/llvm/llvm-project/pull/143034

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-24 Thread James Y Knight via cfe-commits
jyknight wrote: > This might not actually be fixed in the latest boost::mpl. Hm, indeed. It seems that the "[trick](https://github.com/boostorg/mpl/issues/69#issuecomment-1316152037)" they used to solve it in mpl indeed was fixed/obsoleted by this change -- the trick no longer avoids the er

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-24 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: @erichkeane already added release note in #144407; please take a look to see if it makes sense. https://github.com/llvm/llvm-project/pull/143034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-24 Thread Erich Keane via cfe-commits
erichkeane wrote: @efriedma-quic : If you haven't already, please add a release note that is pretty descriptive of the error/issue here, so that people can find it in the future. Additionally, a discourse post to the 'potentially-breaking' tag would be a VERY useful place to socialize this.

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: That pattern look like basically the same thing as the neg_one_constexpr testcase I added. The diagnostic is expected. Posted #144407 to add a relnote. https://github.com/llvm/llvm-project/pull/143034 ___ cfe-commits mailing lis

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-16 Thread via cfe-commits
eaeltsin wrote: I'm not questioning the correctness of the change, just sharing the now-breaking pattern that is quite wide-spread. We also hope to handle this internally by patching boost. https://github.com/llvm/llvm-project/pull/143034 ___ cfe-co

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-16 Thread Reid Kleckner via cfe-commits
rnk wrote: If we've had fixes available for years, I think backporting them would be the right call, but this seems like it might be a release-note-worthy change. https://github.com/llvm/llvm-project/pull/143034 ___ cfe-commits mailing list cfe-commit

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-16 Thread James Y Knight via cfe-commits
jyknight wrote: This same code in Boost was already implicated by the 2022 changes, and I reported a bug for it back then. It was fixed a couple years later in Boost 1.86. https://github.com/boostorg/mpl/issues/69#issuecomment-2301411819 mentions two commits that can be backported to older ver

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-16 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > > Internally, we discovered that this patch breaks Boost as used by MySQL. I > > don't have a full external reproducer at the moment and I don't know > > whether the code is valid or not, but I wanted to give a heads up that we > > may need to revisit this. This seems like t

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-16 Thread via cfe-commits
eaeltsin wrote: Sorry, I over-generalized :) Here is the proper sample: ``` template< typename T, T N > struct IC { static const T next_value = static_cast(N + 1); typedef IC< T, next_value > next; }; enum E { integral_to_integral, integral_to_float, float_to_integral, float_to_floa

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: That example doesn't have any int->enum conversions. https://github.com/llvm/llvm-project/pull/143034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-16 Thread via cfe-commits
eaeltsin wrote: I think the pattern is something like ``` enum { const_value = 1 }; template class Foo {...}; Foo foo; ``` https://github.com/llvm/llvm-project/pull/143034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Most likely, the user code is invalid. I was hoping we would get away without hitting any bugs in major frameworks, but I'm not surprised we hit something. If this is widespread, we can look into mitigations, but it's difficult to downgrade constant evaluation errors to w

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-13 Thread Lei Wang via cfe-commits
wlei-llvm wrote: > Internally, we discovered that this patch breaks Boost as used by MySQL. I > don't have a full external reproducer at the moment and I don't know whether > the code is valid or not, but I wanted to give a heads up that we may need to > revisit this. This seems like the kind

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-13 Thread Reid Kleckner via cfe-commits
rnk wrote: Internally, we discovered that this patch breaks Boost as used by MySQL. I don't have a full external reproducer at the moment and I don't know whether the code is valid or not, but I wanted to give a heads up that we may need to revisit this. This seems like the kind of incompatibi

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-09 Thread Eli Friedman via cfe-commits
@@ -2513,6 +2513,9 @@ void testValueInRangeOfEnumerationValues() { // expected-error@-1 {{constexpr variable 'x2' must be initialized by a constant expression}} // expected-note@-2 {{integer value 8 is outside the valid range of values [-8, 7] for the enumeration type 'E1'

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-09 Thread Shafik Yaghmour via cfe-commits
@@ -2513,6 +2513,9 @@ void testValueInRangeOfEnumerationValues() { // expected-error@-1 {{constexpr variable 'x2' must be initialized by a constant expression}} // expected-note@-2 {{integer value 8 is outside the valid range of values [-8, 7] for the enumeration type 'E1'

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-06 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic closed https://github.com/llvm/llvm-project/pull/143034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/143034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/143034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-05 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/143034 >From 818f2cfd1558a4ee22bd1c3b8ce339eb82a06536 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 4 Jun 2025 19:40:37 -0700 Subject: [PATCH 1/2] [clang] Check constexpr int->enum conversions consisten

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Eli Friedman (efriedma-quic) Changes In 8de51375f12d91675a18d17f262276e65f43fbe0 and related patches, we added some code to avoid triggering -Wenum-constexpr-conversion in some cases. This isn't necessary anymore because -Wenum-constexpr

[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)

2025-06-05 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/143034 In 8de51375f12d91675a18d17f262276e65f43fbe0 and related patches, we added some code to avoid triggering -Wenum-constexpr-conversion in some cases. This isn't necessary anymore because -Wenum-constexpr-co